To transpose the matrix, my code is like this:
def transpose(matrix):
temp_Matrix = matrix[:][:]
for i in range(len(matrix)):
for j in range(len(matrix[0]):
temp_Matrix[i][j]=matrix[j][i]
return temp_Matrix
why this code does not work for the non-square matrix?