python issue with deleting an item from the list

Viewed 31

Following example is very simple:

i have a list named 'a' with two items, apple and peer Then i remove an item from the list in b a should remain untouched, but if I ask for the output of print(a) and print(b), I get the following result. How is this possible?? It confuses me. In my opinion, a should still have 2 elements, not 1.

a = ['appel','peer'] 
b = a I say, b = a


del b[1] 

print(a)
print(b)

output:

['appel']

['appel']
0 Answers
Related