NumPy exercises with solutions

45 practice problems from the 15 lessons of the NumPy course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.

15 easy problems 15 medium problems 15 hard problems

Why NumPy

3 problems · Read the lesson

Creating arrays

3 problems · Read the lesson

Data types: dtype

3 problems · Read the lesson

Indexing and slicing

3 problems · Read the lesson

Views and copies

3 problems · Read the lesson

Boolean masks and where

3 problems · Read the lesson

Vectorised arithmetic and ufuncs

3 problems · Read the lesson

Broadcasting

3 problems · Read the lesson

Reductions along axes

3 problems · Read the lesson

Reshaping and stacking

3 problems · Read the lesson

Sorting, unique values and searching

3 problems · Read the lesson

Statistics with NumPy

3 problems · Read the lesson

Linear algebra with NumPy

3 problems · Read the lesson

Random numbers and simulation

3 problems · Read the lesson

NumPy in practice: images as arrays

3 problems · Read the lesson