Learning Python : >>> import math doesn't work ?

windspy windspy at gmail.com
Sun Nov 18 23:46:20 EST 2007


On Nov 19, 10:48 am, pdlem... at earthlink.net wrote:
> Have carefully installed Python 2.5.1 under XP in dir E:\python25 .
> ran   set path = %path% ; E:\python25
> Python interactive mode works fine for simple arithmetic .
> Then tried >>>  import math
>                 >>>  x = sqrt(100)
>    Get error    Name error : name 'sqrt' is not defined
>         Same thing with sin(x) .
> I'm unable to find "math" , "sqrt" , or "sin" anywhere in lib , Libs
> or include directories .
> The Tutorial does not clear this up .
> Please help.    Thanks  Dave     pdlem... at earthlink.net

use it like: x = math.sqrt (100) and math.sin(x)



More information about the Python-list mailing list