1 ‘‘‘ 2 斐波那契数列 3 1、输出第十个数字 4 1,1,2,3,5,8.... 5 ‘‘‘ 6 def fei(n): 7 a,b = [1,1] 8 for i in range(n-1): 9 a,b = b, a+b 10 return a 11 print(fei(10)) # 55 12 13 # 递归 14 def fib(n): 15 if n ==1 or n ==2: 16 return 1 17 return fib(n-1) + fib(n-2) 18 print(fib(10))