Created
July 23, 2015 00:42
-
-
Save coltin/4911e8b57e3d8a8ad45b to your computer and use it in GitHub Desktop.
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
# Author Sarah Bryant | |
# July 22, 2015 | |
#YOLO | |
# 5! = 120 | |
def factorial(n): | |
solution = 1 | |
while n > 1: | |
solution = solution * n | |
n = n - 1 | |
return solution | |
print "1! =", factorial(1) | |
print "2! =", factorial(2) | |
print "3! =", factorial(3) | |
print "5! =", factorial(5) | |
print "20! =", factorial(20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment