निम्नलिखित कोड का उद्देश्य क्या है?
What is the purpose of the following code ?
import numpy as np
z=[1,2,3]
y=np.array(z)
A)
B)
C)
D)
Explanation:
The code provided:
import numpy as np
z = [1, 2, 3]
y = np.array(z)
Explanation:
z = [1, 2, 3]
: This creates a regular Python list with elements 1, 2, and 3.y = np.array(z)
: This converts the Python listz
into a NumPy array and stores it iny
.
Thus, the purpose of the code is to convert the list z
into a NumPy array.
Answer: (A) to convert z to array