Can someone give and explanation of what is happening with the following:

a,b = 0,1                       # this assigns a = 0 and b = 1

while b < 10:
...     print b
...     a, b = b, a+b
...
1
1
2
3
5
8


a=0
b=1
while b < 1000:
...     print b
...     a = b
...     b = a+b
...
1
2
4
8
16
32
64
128
256
512


Why is this statement ..     a, b = b, a+b
different to ...     a = b
...                             b = a+b


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to