I think I found a strange problem regarding arrays. I initialize an array, array1, with no elements in it, and create another array, say array2, which I initialize to be exactly like array1. This is my code:
array1 = []
array2 = array1
Now, when I append an element to array1 and print out array2, this appears:
array1 = []
array2 = array1
array1.append(0)
print(array2)
>> [0]
Why exactly does array2 have that zero that I appended to array1? Why did it update its elements twice? It's like I wrote:
...
array2 = array1
array1.append(0)
array2 = array1
...
That's very strange in my opinion. Can anybody explain what happened here / what I did wrong?