Python to print the transpose of a given matrix
kodingwindow@kw:~$ python3 ... >>> from numpy import * >>> m = matrix("1 2 3; 4 5 6; 7 8 9") >>> m matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> m.getT() matrix([[1, 4, 7], [2, 5, 8], [3, 6, 9]]) >>> m.transpose() matrix([[1, 4, 7], [2, 5, 8], [3, 6, 9]])
Advertisement