Simple question, but this is giving me trouble.
I have a list with lists inside, can be a function with two variables, say x,y and the result, z, so the list is built like
a = [ [[x1,y1,z11], [x1,y2,z12], ...],
[[x2,y1,z21], [x2,y2,z22], ...],
... ]
Now, I want to build another of this objects, with a different function, let say w:
b = [ [[x1,y1,w11], [x1,y2,w12], ...],
[[x2,y1,w21], [x2,y2,w22], ...],
... ]
Then, to do it, I do this:
b = [[0.0]*len(a[0])]*len(a)
for i in range(len(a)):
for j in range(len(a[0])):
c = a[i][j][:2]
c.append(w(i,j))
b[i][j] = c
ok. Now, when I ask for a[i][j], I get b[i][j]. This is puzzling me because when I try this in the terminal I get the correct a[i][j]. Any help?
The problem is here:
What you need to make are new lists: