I am iterating over each entry of a list of lists and filling it with some unique number but the final list of lists contains identical rows. Here's a MWE:
x = [1,2,3,4]
y = [3,6,9,12]
Here I set up a list of lists filled with zeros.
m = [[0]*len(x)]*len(y)
And I print it to make sure it looks right.
[print(i) for i in m]
Now I iterate through each row and again through each item in the row and put the result of some calculation in each spot.
for i,ii in enumerate(y):
for j,jj in enumerate(x):
m[i][j] = ii*jj
But when I look at the final matrix it is just filled with repeated rows. Any help?
[print(i) for i in m]
