How to Add Two Numbers with User Input in Python


In this example we will show how to add two numbers with user input in Python.

Source Code

a = input('Input a number: ')
b = input('Input another number: ')

sum = int(a) + int(b)
print('The sum is: ', sum)

Output:

Input a number: 4
Input another number: 3
The sum is:  7
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments