Python Practice › NumPy Programs › Program 32

Shape of a matrix

EasyNumPy Programs · 32 of 100

Write a NumPy program to find the shape of a matrix.

Advertisement
Input
[[5, 6, 7], [8, 9, 10]]
Output
(2, 3)

Approach

  1. .shape.

Solution

Python
import numpy as npprint(np.array([[5, 6, 7], [8, 9, 10]]).shape)
Output
(2, 3)

Learn the concept

New to this topic? Read the lesson, then come back.

More numpy programs

← All 100 NumPy Programs

Leave a Comment