menu_book Course Curriculum (NumPy) expand_more
Array Creation
Shape & Indexing
Broadcasting & Vectorization
Aggregation & Statistics
Combining & Splitting
zeros() and ones()
Learn zeros() and ones() in NumPy with a dedicated explanation, a concept-specific example, practical cautions, and a mastery check.
12 min read
•
Beginner
numpy-004.py
python
import numpy as np
mask = np.zeros((2, 3), dtype=bool)
weights = np.ones((2, 3), dtype=float)
print(mask)
print(weights)
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content