suppose I have a list: x=[1,2,3]
I want to make a copy of it: y=x
I want to delete the first element from y: del y[0]
Now y only has 2 elements: [2,3]
BUT
x also has 2 elements too!!
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x=[1,2,3]
>>> y=x
>>> del y[0]
>>> x
[2, 3]
>>> y
[2, 3]
>>>
Why is this? And how do i delete elements from y without effecting x?