Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created April 8, 2018 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/5072221523f3e076db20764903de1b20 to your computer and use it in GitHub Desktop.
Save codecademydev/5072221523f3e076db20764903de1b20 to your computer and use it in GitHub Desktop.
Codecademy export
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