Question: PYTHON ONLY FOLLOW GUIDE GIVEN! Implement the function transpose () in transpose. py that creates and returns a new matrix that is the transpose of
PYTHON ONLY FOLLOW GUIDE GIVEN!
Implement the function transpose () in transpose. py that creates and returns a new matrix that is the transpose of the matrix represented by the argument a. Note that a need not have the same number rows and columns. Recall that the transpose of an m-by-n matrix A is an n-by-m matrix B such that B_i j = A_j i, where 1 lessthanorequalto i lessthanorequalto n and 1 lessthanorequalto j lessthanorequalto m. $ python transpose. py 2 3 1 2 3 4 5 6 1.0 4.0 2.0 5.O 3.0 6.0 import starred import studio # Return a new 2D list representing the transpose of the matrix represented # by the given 2D list a. Note that the a need not have the same number of # rows and columns, def transpose (a): # Get the dimensions of matrix a. m = ... n = ... # Create an n-by-m matrix c with all elements initialized to 0.0. c = ... # Fill in the elements of c such that c [i] [j] = a [j] [i]. ... # Return c. ... # Test client [DO NOT EDIT]. Reads an m-by-n matrix from standard input and # prints it3 transpose. def _main (): a = stdarray.readFloat2D () c = transpose (a) for row in c: for v in row [: -1]: stdio. write (str (v) + ' ') stdio. write ln (row [-1]) if _name_ == ' _main_ ': _main ()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
