On 2006-02-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I like Fredrik's solution. If for some reason you are afraid of
> logarithms, you could also do:
>
>>>> x = 4978
>>>> decades = [10 ** n for n in xrange(-1,8)]
>>>> import itertools
>>>> itertools.ifilter(lambda decade: x < decade, decades).next()
> 10000
>
> BTW, are the python-dev guys aware that 10 ** -1 = 0.10000000000000001 ?
You're joking, right?
--
Grant Edwards grante Yow! HOORAY, Ronald!! Now
at YOU can marry LINDA
visi.com RONSTADT too!!
--
http://mail.python.org/mailman/listinfo/python-list