0 / 34
Lesson 8

Element-wise Math

Operators work element-by-element:

a + b   # [11, 22, 33]
a * b   # [10, 40, 90]
a ** 2  # [1, 4, 9]

This is vectorization.

Why this matters

Vectorization is the reason NumPy feels like "math on whole arrays": one expression, many elements, compiled loops underneath. It is the default style in scientific Python and a prerequisite for readable ML code.

Keeping code in this form also makes GPU frameworks and batch APIs easier to adopt later.

ResourcesDocs, references & more โ€” opens in a new tab
๐ŸŽฏ Your Task

Given temps_f = np.array([32,68,100,212]), compute temps_c = (F-32)*5/9.

(temps_f - 32) * 5 / 9
exercise.py
โŒ˜โŽ run ยท โŒ˜โ† โ†’ nav
โ–ถ Output
Run your code to see output here.