On Sun, 24 Nov 2013 11:24:43 +0100, Rafael Knuth <[email protected]> wrote:
    a, b = b, a +b


a = b = 1
b = a + b = 1 + 1 = 2

I suggest you play with the statement a bit. Print out both values each time through the loop.

The expression b, a+b produces a tuple. The left side a, b *unpacks* that tuple into the two variables.a and b.

Perhaps a simpler case might help. Try a, b = b, a What would you expect it to do and why?

--
DaveA

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to