Thank you very much, Tõnis!: *** 1 *** >you forgot to import math module >>> import math
Nope, I did not! But I used sqrt(9), and not math.sqrt(9). The latter works excellent, thank you! From now on, I will use "import math" and "math.fuction()" for EVERY mathematical function, even for pow() etc. just to be on the safe side! *** 2 *** >if you want math functions to your current namespace use: >>> from math import * What is a "namespace" and what is the difference between ">>>import math" and ">>>from math import *" ? Siggi "tonisk" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] you forgot to import math module >>> import math >>> math.sqrt(9) 3.0 if you want math functions to your current namespace use: >>> from math import * -- Tõnis On Jan 4, 10:13 am, "siggi" <[EMAIL PROTECTED]> wrote: > 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 > > Inhttp://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
-- http://mail.python.org/mailman/listinfo/python-list