I have the following issue:
I have a list of lists with the following declaration:
As = [[0]*3]*3
I then try to change the values of this "matrix" with this:
for i in range(3):
for j in range(3):
As[i][j] = calculate(A, i, j)*((-1)**(i+j))
As you may have guessed, this is used in calculating the inverse of a 3x3 matrix.
The function calculate returns the following values:
4.0
-2.0
-3.0
-4.0
-10.0
9.0
4.0
10.0
-21.0
However, As has the following value:
[[4.0, -10.0, -21.0], [4.0, -10.0, -21.0], [4.0, -10.0, -21.0]], which is unexpected.
What am I missing?