Write a function that outputs the transpose of a matrix - a new matrix
where the columns and rows of the original are swapped.

For example, the transpose of:
  
    | 1 2 3 |
    | 4 5 6 |

is

    | 1 4 |
    | 2 5 |
    | 3 6 |

The input to your function will be an array of matrix rows. You can
assume that each row has the same length, and that the height and
width of the matrix are both positive.

Source: codewars | Difficulty: EASY
Tags: Matrices

Mathematics

Starter code: def transpose(matrix):
	

Solutions:
def transpose(matrix):
	return list(map(list, zip(*matrix)))


def transpose(matrix):
	return [[row[i] for row in matrix] for (i, col) in enumerate(matrix[0])]


import numpy as np

def transpose(matrix):
	return list(map(list, zip(*matrix)))
	return np.transpose(matrix).tolist()


import numpy as np

def transpose(matrix):
	return np.transpose(np.matrix(matrix)).tolist()


def transpose(matrix):
	transp = []
	for i in range(len(matrix[0])):
		transp.append([matrix[j][i] for j in range(len(matrix))])
	return transp


def transpose(matrix):
	return [[matrix[j][i] for j in range(len(matrix))] for i in range(len(matrix[0]))]


import numpy as np

def transpose(matrix):
	return np.mat(matrix).T.tolist()


def transpose(matrix):
	return [list(t) for t in zip(*matrix)]


transpose = lambda m, l=list: l(map(l, zip(*m)))