Code:
#Program to Add, Subtract, Multiply, Divide, Print Remainder and compare two integer values function=0
while function!=1:
print(‘1. Multiply’)
print(‘2. Division’)
print(‘3. Add’)
print(‘4. Subtract’)
print(‘5. Remainder’)
print(‘6. Comparison’)
print(‘7. Exit\n’)
function= input(‘What function do you want to do?\n’)
#print(function)
if function== ‘1’:
x=int(input(‘What is the first number?\n’))
y=int(input(‘What is the second number?\n’))
print(x*y)
print (‘\n’)
if function== ‘2’:
x=int(input(‘What is the first number?\n’))
y=int(input(‘What is the second number?\n’))
print(x/y)
print (‘\n’)
if function== ‘3’:
x=int(input(‘What is the first number?\n’))
y=int(input(‘What is the second number?\n’))
print(x+y)
print (‘\n’)
if function== ‘4’:
x=int(input(‘What is the first number?\n’))
y=int(input(‘What is the second number?\n’))
print(x-y)
print (‘\n’)
if function== ‘5’:
x=int(input(‘What is the first number?\n’))
y=int(input(‘What is the second number?\n’))
print(x%y)
print (‘\n’)
if function== ‘6’:
x=int(input(‘What is the first number?\n’))
y=int(input(‘What is the second number?\n’))
if x < y:print (“X is less than Y” ‘\n’)
elif x > y: print (“X is greater then y” ‘\n’)
if function== ‘7’: print (“Thank You Have A Nice Day” ‘\n’)
Lab Description:
We had created this lab using loops, while and if formulas. It was a bit difficult at first and once we had started the lab it was much easier to continue the code. The lab requires basic knowledge of loops and understanding of python.