I was going through an python 3.7 documentation and I saw this example code which I tried out and had the following results.
>>> # Fibonacci series:
... # the sum of two elements defines the next
... a, b = 0, 1
>>> while a < 10:
... print(a)
... a, b = b, a+b
...
0
1
1
2
3
5
8
I then tried to rewrite the code differently hoping to produce the same results. However I tried the following and got a different result. Please what is the difference between this and that above and why are the results different.
>>>a, b = 0, 1
>>>while a < 10:
print(a)
a = b
b = a + b
0
1
2
4
8