Tensor Puzzles
Rebuild NumPy functions in one line using only broadcasting
Tensor Puzzles gives you 21 small tasks. In each one you rebuild a common NumPy function, such as ones, cumsum, outer or bincount. The rules are strict. Each answer must fit on one line under 80 characters, and you may only use arithmetic, comparisons, indexing, shape, the @ operator and the functions you wrote in earlier puzzles.
Free · No login · Browser · Intermediate

About Tensor Puzzles
The puzzles teach broadcasting, the core trick behind fast tensor code. They suit people who know some Python and want a deeper feel for how array libraries work, such as machine learning students.
The puzzles are a Jupyter notebook on GitHub, and the author suggests running it in Google Colab. Each puzzle has a test to check your answer. It is free and open source under the MIT license.
On Breakpoint since 23 Oct 2026.
