get number that is raised to the power of
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri May 2 05:29:19 EDT 2008
On Fri, 02 May 2008 19:19:07 +1000, Astan Chee wrote:
> Hi,
> Im not sure if this is more of a math question or a python question. I
> have a variable in python:
> >>> v = 10.0**n
> is there a way to find the value of n if i know only v aside from
> str(v).split('+')[1] ? that seems like too much of a hack and I was
> wondering if there was a faster way of doing it?
That hack isn't even working properly because ``str(10.0**1)`` has no '+'
in its string representation.
Solution:
n = math.log(v, 10)
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list