Joon wrote: > >>> a, b = 0, 1 > >>> while b < 10: > print b > a = b > b = a+b > > > 1 > 2 > 4 > 8 > > Why a, b = b, a+b isn't a = b; b = a+b ?
Because you changed a before you added it to b. Let's call your existing a and b "a0" and "b0", and the next a and b "a1" and "b1". When you do a, b = b, a+b you are assigning: a1 = b0 b1 = a0 + b0 But when you use separate statements, you are assigning: a1 = b0 b1 = a1 + b0 = b0 + b0 = 2*b0 -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list