Python Program to Add Two Numbers

Python Program to Add Two Numbers

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn  Python programming concepts. You can learn Python language at your own speed and time. One can learn concepts of Python language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Python Program to Add Two Numbers
Python Program to Add Two Numbers

Write a Python Program to Add Two Numbers

PROGRAM: Python Program to Add Two Numbers

/*Python Program to Add Two Numbers */

 1: Add Two Numbers

num1 = 1.5
num2 = 6.3
sum = num1 + num2
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum)) OUTPUT:-
The sum of 1.5 and 6.3 is 7.8

2: Add Two Numbers With User Input

num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
sum = float(num1) + float(num2)
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum)) OUTPUT:-
Enter first number: 1.5
Enter second number: 6.3
The sum of 1.5 and 6.3 is 7.8

Leave a Reply

Your email address will not be published. Required fields are marked *