Lab Description: In the beginning of the program I start off with a loop so later on after you finish it would go back to the main menu and let you try a different option, The same one or even exiting. and the rest is the same as lab 2 but this time each category is separate where you would have to chose your numbers for the option you chose. Then it will execute your option and then loop you back to the main menu, unless you chose to exit.
Code:
option = [1,2,3,4,5,6] while (option == 1,2,3,4,5,6): option = input ("select an option: (1)Add Numbers (2)Subtract Numbers (3)Multiply Numbers (4)Divide Nundbers (5)Remainder Numbers (6)Compare Numbers (7)Exit") print option if (option == 1): suboption = input ("Choose suboption (1)Enter numbers") if (suboption == 1): x = input ("Enter value x") y = input ("Enter value y") z = x+y print "x+y =", z if (option == 2): suboption = input ("Choose suboption (1)Enter numbers") if (suboption == 1): x = input ("Enter value x") y = input ("Enter value y") z = x-y print "x-y =", z if (option == 3): suboption = input ("Choose suboption (1)Enter numbers") if (suboption == 1): x = input ("Enter value x") y = input ("Enter value y") z = x*y print "x*y =", z if (option == 4): suboption = input ("Choose suboption (1)Enter numbers") if (suboption == 1): x = input ("Enter value x") y = input ("Enter value y") z = x/y print "x/y =", z if (option == 5): suboption = input ("Choose suboption (1)Enter numbers") if (suboption == 1): x = input ("Enter value x") y = input ("Enter value y") z = x%y print "x%y =", z if (option == 6): suboption = input ("Choose suboption (1)Enter numbers") if (suboption == 1): x = input ("Enter value x") y = input ("Enter value y") if x < y: print 'x is less than y' elif x > y: print 'x is greater than y' else: print 'x and y are equal'
Screenshots: