Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

Python. 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 (anonymous):

because you import all from math by using this 'from math import * ' you don't have to write math.e use x = e or use 'import math' to write 'x = math.e'

OpenStudy (rsmith6559):

"from math import *" imports all of math's functions and properties into the current namespace. "import math" imports the math's namespace into the current name space. The first form doesn't have a math namespace, the second does. So math.e would only be used with the second form.

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!
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!