Basically what I'm trying to do is, create a nestled list and set a value of one of its element as a function of other elements in the list.
>>> a = [[1]*5]*5
>>> a
[[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]
>>> a[2][2] = a[0][2] + a[2][1]
>>> a
[[1, 1, 2, 1, 1], [1, 1, 2, 1, 1], [1, 1, 2, 1, 1], [1, 1, 2, 1, 1], [1, 1, 2, 1, 1]]
>>> a[3][2]
2
>>> a[4][2]
2
>>> a[4][4]
1
I just set the value of a[2][2] but the same value got set to every element in the 3rd column. What is going on exactly and how can I get the desired behavior?