निम्नलिखित कोड का आउटपुट क्या है? एनपी के रूप में सुन्न आयात करें
What is the output of following code ? import numpy as np
a = np.array([[1,2,3],[4,5,6]])
print(a.shape)
A
(2, 3)
B
(3, 2)
C
(1, 1)
D
None of these
Explanation
Let's break down the code:
import numpy as np
a = np.array([[1, 2, 3], [4, 5, 6]])
print(a.shape)
ais a 2x3 numpy array (2 rows and 3 columns).- The
.shapeattribute 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).
Correct Answer: A) (2, 3)