मराठी

Create the following NumPy arrays: A 1-D array called zeros having 10 elements and all the elements are set to zero.

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
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 6: Introduction to NumPy - Exercise [पृष्ठ ११३]

APPEARS IN

एनसीईआरटी Informatics Practices [English] Class 11
पाठ 6 Introduction to NumPy
Exercise | Q 4. a) | पृष्ठ ११३
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×