Last active
April 16, 2018 19:11
-
-
Save bergpb/f139052560c657a756b5b567d40fcc00 to your computer and use it in GitHub Desktop.
Recursive factorial in python.
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
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