Skip to content

Instantly share code, notes, and snippets.

@LeoCavaille
Created May 15, 2017 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeoCavaille/6e2afd3b897ce6e16a63e5fc9d908c3f to your computer and use it in GitHub Desktop.
Save LeoCavaille/6e2afd3b897ce6e16a63e5fc9d908c3f to your computer and use it in GitHub Desktop.
def factorielle(n):
if n < 0:
raise ValueError("pas de factorielle pour les nombres negatifs")
result = 1
for i in xrange(1, n+1):
result *= i
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment