pow() works but sqrt() not!?

siggi smusnmrNOSPAM at yahoo.com
Thu Jan 4 03:13:22 EST 2007


Hi all,

this is a newbie question on :
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on
win32
PC with WinXP

In
http://www.python.org/doc/2.3.5/lib/module-math.html
I read:

"sqrt( x) Return the square root of x."

Now the test for module math with function pow():
---------------------------------------------------
>>> pow(9,9)
387420489

 Fine, but sqrt() fails:
-------------------
>>> sqrt(9)
I get this error message

'Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    sqrt(9)
NameError: name 'sqrt' is not defined'

Same for sin() and cos(). ">>> Import math" does not help. Will I have to
define the sqrt() function first? If so, how?

Please help!

Thank you,

Siggi













More information about the Python-list mailing list