Skip to content

Instantly share code, notes, and snippets.

@mattyw
Created July 21, 2011 20:46
Show Gist options
  • Save mattyw/1098163 to your computer and use it in GitHub Desktop.
Save mattyw/1098163 to your computer and use it in GitHub Desktop.
When you're bored, do some recursion
def fact(x):
if x == 0:
return 0
elif x == 1:
return 1
else:
return x * fact(x-1)
for x in range(0,10):
print x, fact(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment