方式一:函数 1 def fabs(n): 2 a, b = 0, 1 3 while b < n: 4 print(b, end=' ') 5 a, b = b, a+b 6 7 fabs(1000) View Code 方式二:列表