递归练习
#阶乘
def factorial(x):
if x == 1:
return 1
return x * factorial(x-1)
#猴子一天吃一半多一个
def monkey(n):
if n == 1:
return 1
return (monkey(n-1)+1)*2
#斐波那契
def fib(n):
if n < 1:
return 1
return fib(n-1) + fib(n-2)