
Patrick B. answered 02/18/21
Math and computer tutor/teacher
import math
print("---- OPERATIONS MENU ---------------")
print(" <1> Addition")
print(" <2> Subtraction")
print(" <3> Multiplication")
print(" <4> Division ")
print(" <5> Power//Exponent ")
print(" <6> Modulus Division ")
print(" <7> Square Root ")
x=input("Please input the selection:>")
if (int(x)==1):
a = input("Please input the first number:>")
b = input("Please input the 2nd number :>")
c = float(a)+float(b)
print(" The sum of " + str(a) + " + " + str(b) + " = " + str(c))
if (int(x)==2):
a = input("Please input the first number:>")
b = input("Please input the 2nd number :>")
c = float(a)-float(b)
print(" The difference of " + str(a) + " - " + str(b) + " = " + str(c))
if (int(x)==3):
a = input("Please input the first number:>")
b = input("Please input the 2nd number :>")
c = float(a)*float(b)
print(" The product of " + str(a) + " * " + str(b) + " = " + str(c))
if (int(x)==4):
a = input("Please input the first number:>")
b = input("Please input the 2nd number :>")
if (float(b)!=0):
c = float(a)/float(b)
print(" The quotient of " + str(a) + " / " + str(b) + " = " + str(c))
else:
print("DIvision by zero not allowed")
if (int(x)==5):
a = input("Please input the base number:>")
b = input("Please input the exponent :>")
c = math.pow(float(a),float(b))
print(" The base of " + str(a) + " raised to the power of " + str(b) + " = " + str(c))
if (int(x)==6):
a = input("Please input the first number:>")
b = input("Please input the 2nd number :>")
if (float(b)!=0):
c = int(a)%int(b)
print(" The remainder of " + str(a) + " / " + str(b) + " = " + str(c))
else:
print("DIvision by zero not allowed")
if (int(x)==7):
T = input("Please input the number :>")
if (float(T)>=0):
c = math.sqrt(float(T))
print("The square root of " + str(T) + " is " + str(c))
else:
print("Square root of negative number not allowed")