🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित कोड का परिणाम क्या है ?

What is the output of the following code ?

import numpy as np
y = np.array([[11, 12, 13, 14], [32, 33, 34, 35]])
print(y.ndim)
A)
B)
C)
D)

Explanation:

Let's analyze the code:

import numpy as np
y = np.array([[11, 12, 13, 14], [32, 33, 34, 35]])
print(y.ndim)
  • y is a 2D array with 2 rows and 4 columns.
  • The ndim attribute in NumPy returns the number of dimensions of the array.

Since y is a 2D array, y.ndim will return 2.

Answer: (B) 2.

Latest Updates