I am trying to fill a matrix in python in a straightforward (probably not efficient) way:
coord = [0]*3
coords = [[0]*3]*4
for i in range(4):
for j in range(3):
coord[j]= i
coords[i] = coord
I would expect the output for "coords" to be [[0,0,0],[1,1,1],[2,2,2],[3,3,3]]
but instead I am getting [[3, 3, 3], [3, 3, 3], [3, 3, 3], [3, 3, 3]]
is my matrix algebra bad, or is there something I don't understand about python?