ENC: math module

Alves, Carlos Alberto - Coelce calves at coelce.com.br
Thu Jan 10 06:42:50 EST 2002


Yes, You must use the complete reference to the object <modulename.object>
just like this:

import math
math.exp(10) or math.sqrt(10)

Or, on the other hand, you can use the explicity form of import statement
(from <modulename> import object) if you don't want use the form above. See
below:

from math import exp,sqrt
exp(10)
sqrt(4)

-----Mensagem original-----
De: gombosk at vas.birosag.hu [mailto:gombosk at vas.birosag.hu] 
Enviada em: quinta-feira, 10 de janeiro de 2002 07:00
Para: Jason Orendorff
Cc: python-list at python.org
Assunto: math module



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

This is the problem...

Katalin


-- 
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20020110/75361766/attachment.html>


More information about the Python-list mailing list