This program is more complicated when it comes to the code but what it does is really simple. This programs allows you to do various mathematical operation when you choose them.In other words the programs displays a menu so you can choose what math operation you need to do at the time.

Source Code

 

# Menu program

def menu():
#print what options you have
print “1) Addition”
print “2) Subtraction”
print “3) Multiplication”
print “4) Division”
print “5) Remainder”
print “6) Comparison”
print “7) Exit”
print ” ”
return input (“Choose your option: “)
def add(a,b):
print a, “+”, b, “=”, a + b
def sub(a,b):
print a, “-“, b, “=”, a – b
def mul(a,b):
print a, “*”, b, “=”, a * b
def div(a,b):
print a, “/”, b, “=”, a / b
def rem(a,b):
print a, “%”, b, “=”, a % b

def com(a,b):

print a, “<==”, b, “=”, a <= b

print a, “>==”, b, “=”, a >= b
print a, “==”, b, “=”, a == b

loop = 1
choice = 0
while loop == 1:
choice = menu()
if choice == 1:
add(input(“Enter the value: “),input(“Enter the value: “))
elif choice == 2:
sub(input(“Enter the value: “),input(“Enter the value: “))
elif choice == 3:
mul(input(“Enter the value: “),input(“Enter the value:”))
elif choice == 4:
div(input(“Enter the value: “),input(“Enter the value: “))
elif choice == 5:
rem(input(“Enter the value: “),input(“Enter the value: “))
elif choice == 6:

com(input(“Enter the value: “),input(“Enter the value: “))

elif choice == 7:
loop = 0

muldiv rem comsum