Project Euler 16: (Iron)Python

Posted by Ben Griswold on Johnny Coder See other posts from Johnny Coder or by Ben Griswold
Published on Wed, 22 Sep 2010 20:23:49 +0000 Indexed on 2010/12/06 16:59 UTC
Read the original article Hit count: 355

In my attempt to learn (Iron)Python out in the open, here’s my solution for Project Euler Problem 16

As always, any feedback is welcome.

# Euler 16
# http://projecteuler.net/index.php?section=problems&id=16
# 2^15 = 32768 and the sum of its digits is
# 3 + 2 + 7 + 6 + 8 = 26.
# What is the sum of the digits of the number 2^1000?
import time
start = time.time()

print sum([int(i) for i in str(2**1000)])

print "Elapsed Time:", (time.time() - start) * 1000, "millisecs"
a=raw_input('Press return to continue')

© Johnny Coder or respective owner

Related posts about ironpython

Related posts about languages