transpose matrix function python without numpy code example
Example 1: transpose matrices numpy
import numpy as np
A = [1, 2, 3, 4]
np.array(A).T # .T is used to transpose matrix
Example 2: transpose matrix python
arr = list(list(x) for x in zip(*arr))