# Program 6: Find Sum of Two Floating Numbers - 1000+ Python Programs

Question 6) Write a program to find the sum of two floating numbers in Python.

## Example 1: Hardcoded Floating Points

``````# Program 6: Example 1
# Add two hardcoded floating points
# 1000+ Python Programs by Code2care.org

float_no1 = float('11.4')
float_no2 = float('12.4')

sum_of_floats = float_no1 + float_no2

print(f"Sum of {float_no1} and {float_no2} is {sum_of_floats}")``````
Output:

Sum of 11.4 and 12.4 is 23.8

Explanation:
1. Create a variable float_no1 and store a float value for number 1 using the float function
2. Create a variable float_no2 and store a float value for number 2 using the float function
3. Now, create a third variable where we add these two floats.
4. Print the result using a print function with f-strings. ## Example 2: Using user inputs

``````# Program 6: Example 2
# Add two user inputted floating points
# 1000+ Python Programs by Code2care.org

float_1 = float(input("Enter float 1: "))
float2 = float(input("Enter float 2: "))

sum_of_floats = float_no1 + float_no2

print(f"Sum of {float_no1} and {float_no2} is {sum_of_floats}")``````
Output:

Enter float 1: 10.3
Enter float 2: 10.5
Sum of 11.4 and 12.4 is 23.8 ## Functions used:

1. print(): Built-in function to print a string on the console with f-strings formatting.
2. float(): Built-in function to convert String argument to float value.
3. input(): Built-in function to accept user input
{"ft_lang_label":"__label__en","ft_lang_prob":0.5189052,"math_prob":0.986423,"size":1153,"snap":"2023-14-2023-23","text_gpt3_token_len":353,"char_repetition_ratio":0.16710183,"word_repetition_ratio":0.21348314,"special_character_ratio":0.3174328,"punctuation_ratio":0.13122173,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99802756,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,2,null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-03-31T05:34:12Z\",\"WARC-Record-ID\":\"<urn:uuid:ff92849c-358a-4ca2-b9a0-3f9f8aeec05b>\",\"Content-Length\":\"105609\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2479fb57-aaaf-418c-88e4-fb8c7000ef89>\",\"WARC-Concurrent-To\":\"<urn:uuid:49e1695f-ea20-4575-b60a-bfd6fca5b898>\",\"WARC-IP-Address\":\"104.21.91.10\",\"WARC-Target-URI\":\"https://code2care.org/python-programs/6-sum-of-two-floating-numbers-python\",\"WARC-Payload-Digest\":\"sha1:ZNKVIOLAK34SBJQNPHHOQNRGVHEWGIO5\",\"WARC-Block-Digest\":\"sha1:NNVGZ4OBNRITKSHFVFKC75OSFPDR5UDG\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296949573.84_warc_CC-MAIN-20230331051439-20230331081439-00618.warc.gz\"}"}