0 / 34

Invite others

Progress

0 / 34

Array Generators

NumPy generators:

np.zeros((2, 3))     # 2×3 zeros
np.ones((4,))        # [1. 1. 1. 1.]
np.arange(0, 10, 2)  # [0, 2, 4, 6, 8]
np.linspace(0, 1, 5) # 5 evenly spaced
Why this matters

Real pipelines start with correctly shaped templates (zeros/ones), ranges (arange), or resampled grids (linspace) instead of building lists in Python loops.

Four panels: zeros grid, ones vector, arange step sequence, linspace even points on a line.
Generators encode intent: allocation, counting, or smooth sampling.

Preallocating with zeros/ones is also the usual pattern before filling arrays in numerical code.

ResourcesDocs, references & more — opens in a new tab
🎯 Your Task

Create ramp using np.linspace11 values from 0 to 100.

np.linspace(0, 100, 11)
exercise.py
⌘⏎ run · ⌘← → nav
Output
Run your code to see output here.