Skip to content

Instantly share code, notes, and snippets.

@bergpb
Last active April 16, 2018 19:11
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 bergpb/f139052560c657a756b5b567d40fcc00 to your computer and use it in GitHub Desktop.
Save bergpb/f139052560c657a756b5b567d40fcc00 to your computer and use it in GitHub Desktop.
Recursive factorial in python.
import sys
n = int(sys.argv[1])
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment