斐波那契数列 1、使用for循环 def fun(n): a,b=0,1 for i in range(n+1): a,b=b,a+b return a 2、使用递归函数 def funA(n): if n==1: return 1 else: return fun(n-1)+fun(n-2)