# -*- coding:utf-8 -*- #0 1 1 2 3 5 8 13 21 34 55... #简单的斐波那契数列 s = 20 def fb(s): f = [] a = 0 b = 1 while len(f) < s: f.append(b) b, a = a + b, b print(f) fb(s) #高级的斐波那契数列 s = 10 def recur_febo(n): if n <= 1: return n else: return (recur_febo(n-1)) + recur_febo(n-2) for i in range(s): print(recur_febo(i))