Reference no: EM132356927
Question
Your task now is to construct a Python function called transpose which expects one argument: a two-dimensional table representing a matrix.
This matrix does not have to be a square matrix. The transpose of a matrix is a new matrix whose rows are the columns of the original and whose columns are the rows of the original.
EX: m5 = [[1, 2, 3, 4], [5, 6, 7, 8]]
m6 = [[1, 2, 3, 4]]
m7 = [[1, 2], [3, 4], [5, 6]]
>>> transpose(m5)
[[1, 5], [2, 6], [3, 7], [4, 8]]
>>> transpose(m6)
[[1], [2], [3], [4]]
>>> transpose(m7)
[[1, 3, 5], [2, 4, 6]]