Can someone please explain how this is possible??
>>> a = [1,2,3,4,5,5,5,5,4,3,2,2]
>>> a
[1, 2, 3, 4, 5, 5, 5, 5, 4, 3, 2, 2]
>>> b = a
>>> b.remove(1)
>>> b
[2, 3, 4, 5, 5, 5, 5, 4, 3, 2, 2]
>>> a
[2, 3, 4, 5, 5, 5, 5, 4, 3, 2, 2]
How is the remove
method able to access a
when I called it on b
? I can work around this by importing copy and copying the list that way but If someone can explain how the above is possible that would be amazing!
Blockquote