Login using Social Account
     Continue with GoogleLogin using your credentials
Transpose of a matrix (with rank >= 2) interchanges the rows and columns of the matrix.
We can get the transpose of a matrix (or array) by using the attribute T
.
import numpy as np
M = np.arange(6).reshape(2, 3)
print(M)
The output will be
array( [ [0, 1, 2],
[3, 4, 5] ] )
Now let us perform the transpose on M
print("Transpose = ", M.T)
The output will be
array( [ [0, 3],
[1, 4],
[2, 5] ] )
Please follow the below steps:
(1) Please import the required libraries
import numpy as np
(2) Please create a Numpy array called N
of size 6 and shape as (3,2)
<<your code comes here>> = np.arange(<<your code comes here>>).reshape(<<your code comes here>>)
(3) Print array N
using the print()
function to see its values
print(<<your code comes here>>)
(4) Print the transpose of array N
print("Transpose = ", <<your code comes here>>)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...