The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Python Code
Posted by: chucks | February 2, 2010 @ 1:12pm
Python Code
[
Download
]
# +--------------------------------------------------------------------------+ # | 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? | # +--------------------------------------------------------------------------+ # Populate a list, L, with the digits of 2^1000 x = 2**1000 S = str(x) L = [] for x in range(len(S)): L.append(int(S[x])) # And add them sum = 0 for x in range(len(L)): sum += L[x] print sum
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.86 / 8
66 Votes
http://codebin.yi.org/476
page generated in 0.00 seconds