You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
254 B
14 lines
254 B
9 years ago
|
import math
|
||
|
|
||
|
#print the sum of the digits of 2^1000
|
||
|
|
||
|
product = str('%f' % math.pow(2, 1000))
|
||
|
sum = 0
|
||
|
|
||
|
for char in product:
|
||
|
if char == '.': # I can't really be bothered to do the conversion
|
||
|
break
|
||
|
sum += int(char)
|
||
|
|
||
|
print(product)
|
||
|
print(sum)
|