Untitled
raw download clone
TEXT
views 31
,
size 259 b
matrix = [[1,2,3],[4,5,6],[7,8,9]]

def matrix_transpose(n):
	matrix_copy = deepcopy(n)
	for i, row in enumerate(matrix_copy):
		for j, v in enumerate(row):
			matrix_copy[i][j] = matrix_copy[j][i]
	return matrix_copy

print(matrix_transpose(matrix))
close fullscreen
Login or Register to edit or fork this paste. It's free.