To add two numbers in python, you have to ask from user to enter two numbers to find the sum of given two numbers as shown here in the program given below.
Following python program ask from user to enter any two number to find and print the sum of those two numbers:
# Python Program - Add Two Numbers while True: print("Enter '0' for exit.") print("Enter two numbers: ") val1 = int(input()) val2 = int(input()) if val1 == 0: break else: sum = val1 + val2 print("Sum of the given two number:",sum,"\n")
Here is the sample run of the above Python program shows how to add two numbers:
You may also like to learn or practice the same program in other popular programming languages: