in this code i first ask the user for the trigonometric function and then ask for the angle in radians or degrees. according to the code, the console should print error, but on running the code, the first if statements accept any input as true.the final coputed value is also worng. please suggest what to do and any other relevant changes that can be made to the code.
from math import *
trigFunc = str(input("What function do you want to use? Sine, Cosine or Tangent: "))
if trigFunc.lower == "sine" :
radOrDeg = str(input("Do you want to input the value as radians or degrees? "))
if radOrDeg.lower == "radians" :
angle = int(input("Please input the value of the angle: "))
print(math.sin(angle))
elif radOrDeg.lower == "degrees" :
angle = int(input("Please input the value of the angle: "))
radAngle = int(math.radians(angle))
print(math.sin(radAngle))
else:
print("error")
elif trigFunc.lower == "cosine" :
radOrDeg = str(input("Do you want to input the value as radians or degrees? "))
if radOrDeg.lower == "radians" :
angle = int(input("Please input the value of the angle: "))
print(math.cos(angle))
elif radOrDeg.lower == "degrees" :
angle = int(input("Please input the value of the angle: "))
radAngle = int(math.radians(angle))
print(math.cos(radAngle))
else:
print("error")
elif trigFunc.lower == "tangent" :
radOrDeg = str(input("Do you want to input the value as radians or degrees? "))
if radOrDeg.lower == "radians" :
angle = int(input("Please input the value of the angle: "))
print(math.tan(angle))
elif radOrDeg.lower == "degrees" :
angle = int(input("Please input the value of the angle: "))
radAngle = int(math.radians(angle))
print(math.tan(radAngle))
else:
print("error")
else:
print("ERROR, the function cannot be used")
input("press enter to exit")