python 斐波纳契数列实现

 >>> # Fibonacci series: ...# the sum of two elements defines the next ...

 >>> a, b = 0, 1

 >>> while b < 10:

                  print(b)

        a, b = b, a+b

第一行,变量 a和b同時获得新的值0和1

在下面的也是同时获得,这样恰好满足了实现。

这样简单吧,继续学习中。

原文地址:https://www.cnblogs.com/65702708/p/1707673.html