Cube Roots

Roy Smith roy at
Thu Jan 2 21:06:09 CET 2003

John Smith <someone at> wrote:
> How does one take a root higher than square roots in Python?  Can I take the
> cube root of a number?

Same way you would in almost any language.  The Nth root of a number
is the number to the 1/Nth power, so:

import math
math.pow (x, 1.0/y)

or, if you wanted to be somewhat silly, math.pow (x, math.pow (y, -1))

More information about the Python-list mailing list