Skip to content

Instantly share code, notes, and snippets.

@jvanasco
Created October 16, 2012 20:16
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 jvanasco/3901700 to your computer and use it in GitHub Desktop.
Save jvanasco/3901700 to your computer and use it in GitHub Desktop.
sum a year
def recurse(number):
as_int = int(number)
if as_int >= 10 :
as_string = str(number)
value = sum(int(i) for i in as_string)
as_int = recurse( value )
return as_int
print recurse(2012)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment