Exercise 2

Write a program in Python that asks the user to enter two numbers a and b and display their sum: a + b.

Solution

a = input("Type value of the number a : ")
b = input("Type value of the number b : ")
# Convert string value to integer
a = int(a)
b = int(b)
s = a+b
print("The sum of a and b is : " , s)
Younes Derfoufi
One thought on “Solution Exercise 2”

Leave a Reply