Answers for "transpose matrix on python"

1

transpose a matrix in python

matrix = ((0, 1), (3, 4), (6, 7))
#Transpose matrix from 3x2 to 2x3

matrix_transpose = tuple(zip(*data))
print(data_transpose)

#Output
((0, 3, 6), (1, 4, 7), (2, 5, 8))
Posted by: Guest on August-21-2021

Python Answers by Framework

Browse Popular Code Answers by Language