a = ['a']
b = ['b']
c = a
ab = [a,b]
print(c)
print(ab)
a[0] = 'c'
print(c)
print(ab)
Returns:
['a']
[['a'], ['b']]
['c']
[['c'], ['b']]
I wanted the c list to remain what it was i.e. ['a']. But it changed after I changed the element in the a list. Why does this happen and how, if at all, can I avoid it.