Given the matrix
matrix = [[2, None],
[2, None]]
I need to compute the transpose of this. I did the following:
def transpose(matrix):
# Makes a copy of the matrix
result = matrix
# Computes tranpose
for i in range(2):
for j in range(2):
result[j][i] = matrix[i][j]
return result
But this gives me the false result:
[[2, None],
[None, None]]
while it should be
[[2, 2],
[None, None]]
Can someone tell me where I went wrong with my code?