[Tutor] sqrt?
Alan Gauld
alan.gauld at btinternet.com
Sun Apr 25 15:25:21 CEST 2010
"Kirk Z Bailey" <kbailey at howlermonkey.net> wrote
> som quadratic equation work. This involves squareroots. So I fired uop
> the interactive idle and imported math. I then tried to play with sqrt.
>
> Nothing.
>
> Importing math does not import a sqrt function.
So what error do you get? Please post it.
Did you try dir(math) to see the list of names? Does it include sqrt?
If the list is not as you expect have you perhaps inadvertantly created
a file called math.py that it is importing instead?
> Now riddle me this: if string.foo makes it do a function FOO on a
> string, whyfore and howcome does math.sqrt not do square roots on a
> simple number like 4???
It does on my system.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list