Let's see how we can add two float numbers in Python using a program.
# Code2care Python Programming:
# Add two float numbers
# in Python
float_number_1 = float(10.97)
float_number_2 = float(11.13)
sum_of_two_float_numbers = float(float_number_1 + float_number_2)
print('Sum: {0} + {1} = {2}'.format(float_number_1, float_number_2, sum_of_two_float_numbers))
PyCharm Output:
/Users/code2care/.local/share/virtualenvs/examples-E9HN9Crc/bin/Python /Users/code2care/PycharmProjects/examples/main.py
Sum: 10.97 + 11.13 = 22.1
Process finished with exit code 0

- Create a variable float_number_1 that holds the first floating number,
- Create a variable float_number_2 that holds the second floating number,
- Now create a variable sum_of_two_float_numbers that holds the sum of the two numbers.
- Make use of the + Operator to add two floats,
- Print the sum in console using print method.
Have Questions? Post them here!
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!