Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 38 Online
OpenStudy (anonymous):

Hi, I am working on MIT 6.189 in hw_2 Ex 2.3 my math functions work in the command line when I use math.sin(math.pi) for example, but when I put the sin and cos values in the multadd function python seems to not recognize the math.sin and math.cos. i tried calling the math library inside the multadd function but it did not work. Does anyone know how to fix this?

OpenStudy (e.mccormick):

Is it tossing any errors?

OpenStudy (anonymous):

Hi, yes this is the error Traceback (most recent call last): File "C:\Users\Sotero\Desktop\Python HW\hw2.py", line 76, in <module> b=math.cos(math.pi/4) NameError: name 'math' is not defined

OpenStudy (e.mccormick):

What import statment(s) did you use? ``` from math import * ``` Is not that great. You might try: ``` import math ``` They did that poorly in the MIT class.

OpenStudy (anonymous):

I did import math .Apparently, I have to be in the command line to write the formula. It does not work in the shell.It is working now. Thanks for your help :)

OpenStudy (e.mccormick):

Strange. I wonder if it has some pathing issue.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
SwaggyMark: Need help on process of annuity problem
1 hour ago 3 Replies 0 Medals
SwaggyMark: Need guidance on how to solve this annuity problem
1 hour ago 25 Replies 1 Medal
Nina001: Tips for acid reflux
1 hour ago 3 Replies 0 Medals
gelphielvr: How would you write Dinitrogen disulfide?
5 hours ago 3 Replies 1 Medal
xXAikoXx: What's ethos, pathos, logos?
6 hours ago 9 Replies 4 Medals
Breathless: Sonic. Dead or alive. IS MINE
10 hours ago 5 Replies 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!