• 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
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • chestercat
I got my questions answered at in under 10 minutes. Go to now for free help!
  • 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!
  • anonymous
try "import math" instead of "from math import *"
  • 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...

Looking for something else?

Not the answer you are looking for? Search for more explanations.