Michael Hoffman wrote: > lucidparadox wrote: >> I'm currently new to Python and I haven't been able to find the >> operator/math function to find the square root or even the x root of a >> number. > > For square root, use math.sqrt(y) > > For x root use y**(1/x) > [...]
>>> 1/3 0 >>> 3.14159 ** (1/3) 1.0 >>> So the cube root of pi is 1? I don't think so. For generic roots use y ** (1.0 / x) until future versions of Python produce floating point results from all divisions as necessary. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Recent Ramblings http://holdenweb.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list