Advertisements
Advertisements
प्रश्न
Create the following NumPy arrays:
A 1-D array called zeros having 10 elements and all the elements are set to zero.
कोड लेखन
Advertisements
उत्तर
We can create a 1-D NumPy array named zeros containing 10 elements, with all elements set to zero, using the zeros() function.
import numpy as np
zeros = np.zeros(10)
print(zeros)
Output:
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
Thus, zeros is a 1-D array containing 10 zero elements.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
