My first day in Python and get confused with a very brief example. Hope someone can give some explanation why there is some difference between these several versions. You are welcome!
V1: output 1, 1, 2, 3, 5, 8
a, b = 0, 1 while b < 10: print(b) a, b = b, a+b
V2: output 1, 2, 4, 8
a, b = 0, 1 while b < 10: print(b) a = b b = a+b
source share