Assuming that the input numbers are given by the user:print "Menu"print "1. Addition"print "2. Subtraction"print "3. Multiplication"print "4. Division"print "0. Quit"
a = input("Please make a selection:")if a == 1: x = input("Please enter a number:") y = input("Please enter another number:") answer = x + yprint "%r plus %r = %r" % (x,y,answer)elif a == 2: x = input("Please enter a number:") y = input("Please enter another number:") answer = x - yprint "%r minus %r = %r" % (x,y,answer)
The same goes for everything else just with different signs. Don't forget that "*" is multiplication and "/" is division. Also, for 0. Just use:
elif a == 0: quit
166 views
Usually answered in minutes!
×