0
Why?
a = 1 b = a a = 2 print(b) # 1 x = [0, 1, 2] y = x x[0] = 3 print(y[0]) # 3 x = 4 print(y) # [3, 1, 2] print(x) # 4 https://code.sololearn.com/cI34f2qP4UMg/?ref=app
1 ответ
+ 2
So when you do this a=1 a will store integer value when you y=x if x= [] (it store reference to array)y will store reference to the array. So if array changes and you call it through y you will see this change. When you do x=4 x no more store reference to array. So cant see it but it is not destroyed since y still have a reference to this array.