python 递归函数

def factoria(n):
    if n == 1:
        return 1
    else:
        return n * factoria(n-1)

def power(x,n):
    if n == 0:
        return 1
    else:
        return x * power(x, n-1)

print(factoria(5))
print(power(3,3))

result:

120
27

  

原文地址:https://www.cnblogs.com/lianghong881018/p/11081182.html