I have a list of lists in python.
z=[[0]*6]*7
Since all elements are 0. But now if i want to change an individual element within a list e.g
z[0][0]=2
This should change the first element of the first list. But it actually changes the first element of all elements. This is so illogical to me. Can some one help.
[2, 0, 0, 0, 0, 0],
[2, 0, 0, 0, 0, 0],
[2, 0, 0, 0, 0, 0],
[2, 0, 0, 0, 0, 0],
[2, 0, 0, 0, 0, 0],
[2, 0, 0, 0, 0, 0]]