i need help on builtin function math

Ruediger Maehl ruediger.maehl at dzsh.de
Thu Mar 29 04:23:19 EST 2001


Marcus Konermann schrieb in Nachricht ...
>i want to use the sqrt() function of the builtin funtion math in that
>kind:
>
>import math
>...
>a=0
>a=sqrt(whatever)
>

Try this:
>>> import math
>>> a = 0
>>> a = sqrt(34)
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
NameError: There is no variable named 'sqrt'
>>> a = math.sqrt(34)
>>> a
5.8309518948453007

or this:
>>> from math import *
>>> a = sqrt(34)
>>> a
5.8309518948453007

HTH,
Rüdiger





More information about the Python-list mailing list