In this python numpy program, we will find the shape of the given matrix using NumPy.
Steps to solve the program
- Import the numpy library as np.
- Create a matrix using np.array().
- Now find the shape of the matrix using shape.
- Print the output.
import numpy as np
x = np.array([[5,6,7],
[8,9,10]])
print("Shape of the matrix: ",x.shape)
Output :
Shape of the matrix: (2, 3)