Answer to Question #265536 in Python for Matteo Villamor

Question #265536



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.

1
Expert's answer
2021-11-13T12:40:50-0500
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)))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS