-
-
Save shibasisp/4d9e069ba6d60f6b05166a4072f5ac4e 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
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