Created
July 25, 2012 22:41
-
-
Save jashsu/3179154 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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