I define a two-dimension array in python like this:
a = [[1]*3]*3
and I want to assign one element to be 2, like:
a[1][1] = 2
However, a turns out to be:
[[1,2,1],[1,2,1],[1,2,1]]
Instead of what I thought like this:
[[1,1,1],[1,2,1],[1,1,1]]
Anyone has any idea?