Run
A = [ [2, 1, 3], [3, 1, 5] ] # Initialize B with size of A transpose B = [[0 for j in range(len(A))] for i in range(len(A[0]))] for j in range(len(A)): for i in range(len(A[0])): B[i][j] = A[j][i] print(' A:', A) print(' B:', B)
Output