This Python program demonstrates how you can add two numbers in python and display it using the print() function.
Python Program to Add Two Numbers
Python program to add two numbers
# python program to add two numbers number1 = 898.2 number2 = 111.6 # Add two numbers and store it in sum sum = number1 + number2 # Display the sum using print print('The sum of {0} and {1} is {2}'.format(number1, number2, sum))
Output
The sum of 898.2 and 111.6 is 1009.8000000000001
In this program , the variables number1 and number2 contains the numeric values that needs to be added. These two variable values are added and the result is stored in the variable sum. This is then displayed using the built-in python function.
Leave a Reply