निम्नलिखित कोड का आउटपुट क्या है? एनपी के रूप में सुन्न आयात करें
What is the output of following code ? import numpy as np
a = np.array([[1,2,3],[4,5,6]])
print(a.shape)
A)
B)
C)
D)
Explanation:
Let's break down the code:
import numpy as np
a = np.array([[1, 2, 3], [4, 5, 6]])
print(a.shape)
a
is a 2x3 numpy array (2 rows and 3 columns).- The
.shape
attribute of a numpy array returns a tuple representing the dimensions of the array.
So, for this array:
- It has 2 rows and 3 columns, so the shape will be
(2, 3)
.
Answer: (A) (2, 3).