Error saying that name 'math' is not defined when trying to use asin()

后端 未结 3 1945
时光说笑
时光说笑 2020-12-11 20:41

I have made a Trignometric calculator (Kind of - it only uses the sine ratio as of now) but I can\'t get it to work right. I get an error that says math is not defined when

3条回答
  •  无人及你
    2020-12-11 21:18

    Corrected version. Your maths is wrong too, but I'm not doing all your homework ;-)

    import math
    trig = raw_input ('What are you looking for? A) I have the opposite, and I want the Hypotenuse. ')
    if trig.lower() == 'a':
        ang = float(raw_input ('Please enter the measure of the angle you have '))
        line = float(raw_input ('Please enter the length of the opposite! '))
        print "answer is", math.asin(ang)*line
    

提交回复
热议问题