elif op==14 :
print ("Functions Menu")
print ("d. asin")
print ("e. acos")
print ("f. atan")
fun = input("Choose the function :")
a = float(nput("Enter the value :"))
dict4 = {'d':math.asin(a), 'e':math.acos(a), 'f':math.atan(a)}
print ("The result is : " + str(dict4.get(fun)))
elif op==15 :
print ("Functions Menu")
print ("g. sinh")
print ("h. cosh")
print ("i. tanh")
fun = input("Choose the function :")
a = float(input("Enter the angle in radians :"))
dict5 = {'g':math.sinh(a), 'h':math.cosh(a),'i':math.tanh(a)}
print ("The result is : " + str(dict5.get(fun)) )
Question:
1. In this program, you will create a class and OOP.
print ("Functions Menu")
Menu = ["asin","acos","atan","sinh","cosh","tanh"]
Option = ['d','e','f','g','h','i']
for r in range(0,len(Menu)):
print(Option[r],". ",Menu[r])
Flag=1
fun = ' '
while(Flag):
if(fun=='d' or fun=='e' or fun=='f' or fun=='g' or fun=='h' or fun=='i'):
Flag=0
else:
fun = input("Choose the function (d/e/f/g/h/i): ")
a = float(input("Enter the value :"))
dict4 = {'d':math.asin(a), 'e':math.acos(a), 'f':math.atan(a), 'g':math.sinh(a), 'h':math.cosh(a),'i':math.tanh(a)}
print ("The result is : " + Menu[ord(fun)-ord('d')]+"("+str(a)+") = "+str(dict4.get(fun)))
Comments
Leave a comment