Skip to content

Instantly share code, notes, and snippets.

@ProProgrammer
Created September 25, 2013 14:15
Show Gist options
  • Save ProProgrammer/6700245 to your computer and use it in GitHub Desktop.
Save ProProgrammer/6700245 to your computer and use it in GitHub Desktop.
The factorial of a non-negative integer x is equal to the product of all integers less than or equal to x and greater than zero.
def factorial(x):
count = 1
for i in range(x):
if x > 1:
count *= x
x -= 1
return count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment