WeCodeAcademy

Vectorized Math

Arithmetic on arrays works element by element, with no loop. A single number is "broadcast" across the whole array, and arrays of compatible shapes combine too. NumPy also has maths functions such as np.sqrt, np.round and np.abs.

Examplepython
Open in editor »
Quick check

What is `np.array([1, 2, 3]) + 10`?

Your turn: write the code

Convert these Celsius temperatures to Fahrenheit with c * 9 / 5 + 32 and print the result.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.