Skip to content

Instantly share code, notes, and snippets.

@jashsu
Created July 25, 2012 22:41
Show Gist options
  • Save jashsu/3179154 to your computer and use it in GitHub Desktop.
Save jashsu/3179154 to your computer and use it in GitHub Desktop.
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>> def factorial(n):
if n < 1:
sys.exit
elif n == 1:
return 1
else:
return n * factorial(n-1)
>>> factorial(5)
120
>>> factorial(1)
1
>>> factorial(-1)
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment