Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 42 Online
OpenStudy (anonymous):

I have imported 'from math import *' and tried to run x = math.e print x (indented properly) but it says error name 'math' is not defined. Using function from Python Standard Library http://docs.python.org/library/math.html

OpenStudy (owlfred):

Hoot! You just asked your first question! Hang tight while I find people to answer it for you. You can thank people who give you good answers by clicking the 'Good Answer' button on the right!

OpenStudy (anonymous):

try "import math" instead of "from math import *"

OpenStudy (vaboro):

if "import math" is used instead of "from math import *" the functions of the math module will have to be called as methods of the math class (excuse me if I accidentally misuse terminology... I'm just reading "how to think like a computer scientist" and try to apply the concepts I learned in the book), for example, instead of writing sqrt() one would have to write math.sqrt() and so on...

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
MakaylaChuck23: Help wats this
2 hours ago 1 Reply 0 Medals
MakaylaChuck23: uh oh
2 hours ago 1 Reply 0 Medals
Treeko: Pics I took w my friend !
4 hours ago 6 Replies 1 Medal
Aliciaa: Is anyone elses QC going wack? Mine keeps freezing and stuff
2 hours ago 26 Replies 0 Medals
autumnp: does anyone have bandlab?
4 hours ago 4 Replies 0 Medals
Jeromeccv: Art for @vanessad123
2 hours ago 49 Replies 4 Medals
ohhhhhhhhhhhhhh: how do i slim my waist fast
4 hours ago 4 Replies 1 Medal
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!