-
-
Save codecademydev/5072221523f3e076db20764903de1b20 to your computer and use it in GitHub Desktop.
Codecademy export
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 digit_sum(x): | |
total = 0 | |
while x > 0: | |
total += x % 10 | |
x = x // 10 | |
print x | |
return total | |
print digit_sum(1234) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment