निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code?
import numpy as np
arr = np.array([1, 2, 3])
print(arr.shape)
A
(3,)
B
(1, 3)
C
(3, 1)
D
(1, 1, 3)
Explanation
The shape attribute of a NumPy array returns a tuple that represents the dimensions of the array.
For the array arr = np.array([1, 2, 3]), it is a one-dimensional array with 3 elements.
So, arr.shape will return (3,), indicating a 1-dimensional array with 3 elements.
Answer: (A) (3,)
Correct Answer: A) (3,)