[Tutor] transforming an integer to a list of integers
H.G. le Roy
hgleroy at gmail.com
Tue Feb 3 16:17:31 CET 2009
Hi,
recently I learned about Project Euler (http://projecteuler.net/) and now
I'm trying to work me through. At the moment I'm thinking about
http://projecteuler.net/index.php?section=problems&id=8
One step for my solution should be transforming this big integer to a list
of integers. I did:
import math
bignr = 12345
bignrs =[]
for i in xrange(math.ceil(math.log10(bignr)):
rem = bignr % 10
bignrs.append(rem)
bignr /= 10
However this "feels" a bit complicated, Do you know a better (more simple,
nice etc.) way to do this?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090203/4c6c7a4f/attachment.htm>
More information about the Tutor
mailing list