For some functions, the recursive definition is the most succinct and expressive. A common example is the factorial() function.
We can see how this is rewritten as a simple recursive function in Python from the following formula:
The preceding formula can be executed in Python by using the following commands:
def fact(n: int) -> int: if n == 0: return 1 else: return n*fact(n-1)
This has the advantage of simplicity. The recursion limits in Python artificially constrain us; we can't do anything larger than about fact(997). The value of 1000! has 2,568 digits and generally exceeds our floating-point capacity; ...