📜  python 递归示例 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:12.338000             🧑  作者: Mango

代码示例5
# Recursive Factorial Example
# input: 5 
# output: 120 (5*4*3*2*1)
def factorial(x):
    if x == 1:
        return 1
    else:
        return (x * factorial(x-1))