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

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

代码示例4
# 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))