Can't get sqrt() func to work

deadair88 deadair at swirvemail.com
Thu Jan 16 21:44:00 EST 2003


Ok...I'm certanly not the Python expert but I do use it for many small
tasks. I'm writing a small program for testing the primality of a
number and need to call the sqrt() function as defined in the C
standard or the python module math or cmath both of which should be
built in. When I call the func sqrt(x) I get an error that looks
something like this:

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

I've tried calling from IDLE and the command prompt both to avail.
I've tried running it from a module file with no luck. I've imported
both math and cmath and still I can't get that darn function to work.
What is the problem here?

Thanks
Jack D T




More information about the Python-list mailing list