Fw: [Tutor] in-built square root function

Ole Jensen learning.python@dbmail.dk
Wed Feb 19 17:03:04 2003


forwarded to tutor@python.org as I sent it directly to Tim by error:

----- Original Message -----
From: "Ole Jensen" <learning.python@dbmail.dk>
To: "Timothy M. Brauch" <tbrauch@tbrauch.com>
Sent: Wednesday, February 19, 2003 10:58 PM
Subject: Re: [Tutor] in-built square root function


>
> Olé
> ole_jensen@dbmail.dk
> ----- Original Message -----
> From: "Timothy M. Brauch" <tbrauch@tbrauch.com>
> To: "Ole Jensen" <learning.python@dbmail.dk>
> Sent: Wednesday, February 19, 2003 10:50 PM
> Subject: Re: [Tutor] in-built square root function
>
>
> > You made a mistake, but it is a very important error to get corrected
when
> > using import.  Look at this...
> >
> > >>> import math
> > >>> sqrt(9)
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > NameError: name 'sqrt' is not defined
> > >>> math.sqrt(9)
> > 3.0
> > >>>
> >
> fair enough... I'll have write math.sqrt, unless of course I do the "from
> math import *(which i'm guessing is all, everything)
>
> I didn't know that so thanks for clearing it up for me, tim.
>
> However I'm now alittle puzzled to why I didn't have to do the same thing
> with the power operator, which worked fine without write the equevalent:
> "math.pow(x,y)"???
>
>