Decimals not equalling themselves (e.g. 0.2 = 0.2000000001)
Diez B. Roggisch
deets at nospam.web.de
Sun Aug 3 13:55:07 EDT 2008
CNiall schrieb:
> I am very new to Python (I started learning it just yesterday), but I
> have encountered a problem.
>
> I want to make a simple script that calculates the n-th root of a given
> number (e.g. 4th root of 625--obviously five, but it's just an example
> :P), and because there is no nth-root function in Python I will do this
> with something like x**(1/n).
There is - pow.
>>> from math import pow
>>> pow(625, .25)
5
Diez
More information about the Python-list
mailing list