How to add two float numbers in Python

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/
Sum: 10.97 + 11.13 = 22.1

Process finished with exit code 0

Python Program add two Floats
Python Program add two Floats
  1. Create a variable float_number_1 that holds the first floating number,
  2. Create a variable float_number_2 that holds the second floating number,
  3. Now create a variable sum_of_two_float_numbers that holds the sum of the two numbers.
  4. Make use of the + Operator to add two floats,
  5. Print the sum in console using print method.

Have Questions? Post them here!

Hello there!,

You are using AdBlocker!

I am an independent developer trying to help fellow developers and students to resolve issues faced on a day-to-day basis, we 'Code to Care' . There is a lot of expenses involved in hosting and managing a website that's the reason we have ads.

A humble request to you to disable adBlocker on and support us pay our bills.

Cod2care - Line's of code for change.

To see contents reload page after unblocking
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities. Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, Tips-n-tricks, How Tos, Blogs, Articles, etc. on various platforms like Windows, Mac, Linux, Mobile platforms, etc. Technologies/Languages like Java, Objective-C, PHP, .Net, Android, SharePoint, jQuery, HTML, CSS, etc.