This is a basic understanding problem.
I tried reordering some code, and though the operations are supposedly equivalent I get different values. I started with this line:
q, r, m = 10*q, 10*(r-m*t), (10*(3*q+r))//t - 10*m
and changed it to:
q*=10; r=10*(r-m*t); m= (10*(3*q+r))//t - 10*m;
(With initial values being q= 1, r= 6, t= 3, m= 3).
When I run only the second line, m gets value -30 (which is accurate if I followed the order-of-operations correctly), while running the first yields m= 0, which is what the program calls for.
What am I missing here? Does the comma method assign the value after all other assignments are done?
x, y = foo, barsyntax, all statements are executed before assigning the values to the variables. When usingx=foo; y=bar, they are not.qassignment. See my answer for details