Apr-05-2019, 03:14 PM
After running
with the variables that are being assigned to in the same order as the final print, the variables on the right are arranged to give correct order
z, y, x = 2, 1, 0 x, z = z, y y = y - z print(x, y, z)you can realise that x = 2, y = 0 & z = 1
with the variables that are being assigned to in the same order as the final print, the variables on the right are arranged to give correct order
x, y, z = y, z, x # same as x, y, z = 0, 1, 2with with the variables that are being assigned to in the reverse order of the final print, the variables on the right are also arrange to give the reverse order.
z, y, x = x, z, y # same as z, y, x = 2, 1, 0then the print is in the order of x, y, z
print(x, y, z)