> def tail_factorial(n, accumulator=1):
> if n == 0: return 1
> else: return tail_factorial(n-1, accumulator * n)
The second line should be "if n == 0: return accumulator"
> if n == 0: return 1
> else: return tail_factorial(n-1, accumulator * n)
The second line should be "if n == 0: return accumulator"
EDIT: Oops. As pointed out below, the code is indeed incorrect, and my comment is irrelevant.