Lesson 7 of 148 min

Vectorization and broadcasting

One line on the whole array replaces a loop, and NumPy repeats a smaller array to fit when the shapes line up on the right.

After this lesson you can replace a loop with one array expression and predict the shape of the result.

Loading the video…

Refreshers

An idea from an earlier lesson shows up here when the video leans on it.

You use this lesson in Lab 3: A thousand digits, no loop, which comes next.

Facts last checked on .