Created
April 14, 2018 09:43
-
-
Save toannd96/bc6a5de7a7e7566a3ffaed711344d34b to your computer and use it in GitHub Desktop.
BT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum_digits(number): | |
str_number = str(number) | |
sum = 0 | |
for i in range(0, len(str_number)): | |
sum += int(str_number[i]) | |
return sum | |
sum_digits(2**1000) | |
>>>1366 | |
sum(int(num) for num in str(2**1000)) >>> 1366 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment