I expect the code below to create x, then make a copy of x which i called y, change x and then output y. That is, I expect the lines of code to be run sequentially.
x = [10,20,30]
y = x
x[1] = 42
print(y)
Instead, y is changed when x is. Why is that, and how should I read the code? the output is:
[10, 42, 30]