Write a Program to Add two Numbers

Write a simple program with python code examples for beginners.in order to show and we are going to add two numbers using Arithmetic Operators.

Python program to add two numbers with user input

In this tutorial we learn write a program to add two numbers and allow the user values. Next We will add one one by number and assign the total to variable sum.

number1 = input(" Please Enter the First Number: ")
number2 = input(" Please Enter the second number: ")

# Using arithmetic + Operator to add two numbers
sum = float(number1) + float(number2)
print('The sum of {0} and {1} is {2}'.format(number1, number2, sum))

Python program to add two numbers output

Here the OutPut.

Please Enter the First Number: 22
 Please Enter the second number: 44
The sum of 22 and 44 is 66.0

 

 

python program to add two numbers with user input

Leave a Comment

Verified by MonsterInsights