Lab Description:
This lab purpose was to create a program displaying a menu allowing the user to input two numbers representing two options.The number (1) would allow the user to input values for variable X and variable Y and the number two to exit the program. The program created below begins by assigning number 1 and 2; then wrote the option as a form of input. After, I used a series of conditionals with given expressions within a while statement to execute the parameters of the LAB.
CODE:
option = 1 option = 2 option = input ("(1) enter a number (2) exit") while option == 1 : if option == 1: X = input ("Enter X ") Y = input ("Enter Y ") Z = X + Y print "X + Y = ", Z Z = X - Y print "X - Y = ", Z Z = X * Y print "X * Y = ", Z Z= X / Y print "X / Y = ", Z Z = X % Y print "X % Y = Z ", Z if X Y : print 'X is greater than Y' else : print 'X and Y are equal' option = input ("(1) enter a number (2) exit") if option == 2 : print ("Goodbye")