math module
Kalle Svensson
kalle at gnupung.net
Thu Jan 10 05:34:54 EST 2002
[gombosk at vas.birosag.hu]
> I have a problem with math module:
>
> I import math module, because to call exp(x) or sqrt(x) does not work.
>
> Do I need anything else to do?
>
> >>> import math
> >>> exp(10)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> NameError: name 'exp' is not defined
To access the names in an imported module, you must prepend the module name:
>>> import math
>>> math.exp(10)
22026.465794806718
Read more about modules, namespaces and import on
http://www.python.org/doc/current/tut/node8.html
Peace,
Kalle
--
Kalle Svensson (kalle at gnupung.net) - Laziness, impatience, hubris: Pick two!
English: http://www.gnupung.net/ Svenska: http://www.lysator.liu.se/~kalle/
Stuff: ["http://www.%s.org/" % x for x in "gnu debian python emacs".split()]
More information about the Python-list
mailing list