Write a python code which takes two
numbers num1, and Num2 and prints their
sum (s), difference (d) and product (p).
Answers
Answers:
x= int (input(" Enter a number"))
y= int (input ("Enter another number"))
choice=input("Enter 1-To Add, 2-Difference, 3-Product")
if choice=='1'
print("Addition of",x,"and",y,"is",x+y)
elif choice=='2':
print ("Difference of",x,"and,y,"is",x-y)
elif choice=='3':
print ("Product of",x,"and",y,"is",x*y)
else:
print ("Wrong Choice")
First Run
Enter a number 12
Enter another number 14
Enter 1-To Add, 2-Difference, 3-Product 1
Addition of 12 and 14 is 26
Second Run
Enter a number 12
Enter another number 14
Enter 1-To Add, 2-Difference, 3-Product 5
Wrong Choice
Third Run
Enter a number 12
Enter another number 14
Enter 1-To Add, 2-Difference, 3-Product 3
Product of 12 and 14 is 168
Explanation:
I've used if condition 1:
elif condition 2:
elif condition 3:
of If-elif-else conditional statement.