Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shibasisp/4d9e069ba6d60f6b05166a4072f5ac4e to your computer and use it in GitHub Desktop.
Save shibasisp/4d9e069ba6d60f6b05166a4072f5ac4e to your computer and use it in GitHub Desktop.
def factorial(n):
if n == 0: return 1
else: return factorial(n-1) * n
def tail_factorial(n, accumulator=1):
if n == 0: return 1
else: return tail_factorial(n-1, accumulator * n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment