Recursion : recursive function « Function « Python Tutorial






def factorial(n):
    if n == 0 or n == 1: # 0! = 1! = 1
        return 1
    else:
        return (n * factorial(n-1))








10.13.recursive function
10.13.1.Recursion
10.13.2.Recursive factorial function.
10.13.3.Recursive fibonacci function.
10.13.4.Recursive Functions