> How do I do cubic (and higher) roots and exponents in Python? I 
> already took
> a look in Python and didn't find anything.

The nth root is just the number raised to the power of 1/n

x = 27
n = 3
exp = 1/n
cube_root = x**exp

or if you prefer:

def root(number, n):
    return number**(1/n)

HTH,

Alan G.
Catching up on mail aftrer 2 days out... 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to