Can't get sqrt() func to work

John E. Barham jbarham at jbarham.com
Thu Jan 16 22:05:22 EST 2003


> I've imported
> both math and cmath and still I can't get that darn function to work.
> What is the problem here?

It's not enough to import math unless you bring the sqrt function into the
global namespace by doing either:
>>> from math import sqrt
>>> sqrt(4)
2.0

or:
>>> import math
>>> math.sqrt(4)
2.0







More information about the Python-list mailing list