In: Computer Science
Write a python program to display a menu with the following options: (1) add, (2) subtract, (3) multiply, (4) divide (5) mod, and (6) do nothing. I
f the user enters something else (except 1-6), the program should display an error message.
Otherwise, it should ask the user for two numbers, perform the calculation, and display the result.
while True:
print("\n1.Add\n2.Subtract\n3.Multiply\n4.Divide\n5.Mod\n6.Do
nothing\n")
num=int(input("Enter (1-6):"))
if 1<=num<=6:
num1=int(input("Enter
1st number:"))
num2=int(input("Enter
2nd number:"))
if num==1:
print("sum is : "+str(num1+num2))
elif num==2:
print("Difference is : "+str(num1-num2))
elif num==3:
print("Product is : "+str(num1*num2))
elif num==4:
print("Division is : "+str(num1//num2))
elif num==5:
print("Mod vlaue is : "+str(num1%num2))
elif num==6:
continue
else:
print("you had entered
invalid number")
break
code:
output:
If you have any queries..please comment..Thank you...