Advertisements
Advertisements
प्रश्न
When we may require to create an array initialised to zeros or ones?
दीर्घउत्तर
Advertisements
उत्तर
An array initialized to zeros or ones is useful when we need to create an array of a particular size with some initial values before performing calculations or storing data. A zero-initialized array is commonly used when we want to start with empty or zero values and update them later. A one-initialized array is useful when we need all elements to start with the value 1, such as in mathematical calculations or matrix operations. In NumPy, we can create them using np.zeros() and np.ones().
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
