Open-source project
rougier/numpy-100 avatar
rougier/numpy-100

rougier/numpy-100: 100 NumPy exercises with solutions, hints and a Binder notebook

100 numpy exercises (with solutions)

14,526 stars6,935 forksPythonMIT

At a glance

What is it?
A collection of 100 NumPy exercises drawn from the mailing list, Stack Overflow and the docs, generated from a single keyed-text source file. Useful as a self-check for people who already know Python, thin as a teaching syllabus.
Who is it for?
Adopt rougier/numpy-100 if you already write Python and want a fixed set of problems to check which NumPy idioms you have never used; read the hints file first and the solutions file only after attempting each one. Do not adopt it as a structured course for beginners, because the README offers no ordering, no difficulty labels and no explanations beyond the code itself.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 35 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 27, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What the exercise set is, and who it is actually for

The README describes the collection as exercises taken from the numpy mailing list, Stack Overflow and the numpy documentation, with some problems written by the author to reach the 100 limit. That provenance matters. These are not problems designed around a curriculum; they are problems that people once asked about in public, which is why they cluster around indexing, broadcasting, array creation and shape manipulation rather than around a topic sequence.

The stated audience is two groups: newcomers and experienced users who want a quick reference, and teachers who need a set of exercises to hand out. The second group is the one the repository is better shaped for. A teacher can pick items, reorder them and pair them with their own explanation. A self-learner gets no ordering, no difficulty labels and no prose explanation of why a solution works. The README points readers who want more to From Python to NumPy, which is a separate work by the same author and not part of this repository.

How the repository is generated from source/exercises.ktx

The markdown and notebook files are not hand-edited. The README states they are created programmatically from the source data in source/exercises.ktx, and that changing the content means editing the source and running the generators.py module with a Python interpreter that has the libraries in requirements.txt installed.

The README describes ktx as a minimal human readable key-values format for storing text indexed by keys. So the pipeline is one-directional: source file in, generated artifacts out. The four markdown variants in the repository root are different renderings of the same content. 100_Numpy_exercises.md holds the questions alone, 100_Numpy_exercises_with_hints.md adds hints, 100_Numpy_exercises_with_solutions.md adds answers, and 100_Numpy_exercises_with_hints_with_solutions.md carries both. There is also 100_Numpy_random.ipynb alongside the main notebook, and initialise.py in the root.

The practical consequence is that a pull request editing the markdown directly is working against the tooling. Any change has to land in the ktx source and be regenerated, which is a higher bar than editing a file and opening a PR. It also means the generated files can drift from the source if someone regenerates with a different version of the generator dependencies, since requirements.txt pins nothing.

Installing the dependencies and regenerating the exercise files

There is no package to install. The repository is cloned and used in place, and the only install step is for the three libraries the generator needs. requirements.txt lists numpy, mdutils and nbformat with no version constraints.

bash
git clone https://github.com/rougier/numpy-100.git
cd numpy-100
python -m pip install -r requirements.txt

After that, running the generator module rewrites the markdown and notebook outputs from the ktx source. The README says to run generators.py with a Python interpreter that has the requirements installed.

bash
python generators.py

If you only want to read the exercises, none of this is necessary. The README offers two direct routes: read them on GitHub via 100_Numpy_exercises.md, or open the notebook on Binder through the badge link. The repository also carries a binder topic tag, and runtime.txt is present in the root, which is the file Binder reads to pick a Python version for the environment.

The Binder notebook and what it does not give you

The README's Binder link points at the notebooks path with the notebook filename URL-encoded. The badge and the link are the only interactive route documented; there is no local notebook setup described, no Jupyter install step, and no mention of how to run the notebook offline beyond opening the .ipynb file yourself.

Binder sessions are ephemeral. Work done in one is not persisted back to the repository, and the README does not document any save or export path. For a set of exercises meant to be attempted, that is a real friction point: the natural workflow is to solve problems and keep the answers, and the documented environment does not retain them. Anyone planning to work through the set seriously is better off cloning the repository and opening the notebook locally, even though the README does not spell that out.

The repository also ships 100_Numpy_random.ipynb, a second notebook. The README does not describe what it contains or how it differs from the main one, so its purpose has to be inferred from the filename alone.

No difficulty ordering, no explanations, and a stale release history

The set is numbered, not graded. Nothing in the README or the file listing indicates which exercises are introductory and which assume fluency with strides, fancy indexing or structured arrays. A reader working front to back will hit uneven difficulty without warning, and a teacher building a syllabus has to sort the items manually.

The solutions file is code, not commentary. There is no explanation of why a particular approach is idiomatic or what the alternatives cost. For a reader who can already read NumPy code that is fine, because the answer is the explanation. For someone still learning the library, a correct answer that they do not understand is a dead end, and the README does not claim otherwise.

Release history is also worth noting. The two releases listed are 1.0 from 2016-07-16 and 1.1 from 2016-08-27. The repository has not been archived and the last push was on 2026-08-26, so changes still land, but the versioned releases are a decade old and the README does not describe a versioning or changelog process. Treat the master branch as the artifact, not a tagged release.

Alternatives: the NumPy tutorial and the From Python to NumPy book

The most direct alternative for a learner is the official NumPy tutorial documentation. The difference is in form: the tutorial explains an idiom and then shows it, while numpy-100 poses a problem and shows the answer with no explanation. If you need the reasoning, the tutorial gives it; if you need to find out which idioms you have never used, the exercises do that faster, because a tutorial will not tell you that you have avoided einsum or stride tricks for years.

The README itself points to From Python to NumPy for extended exercises. That is a book-length treatment by the same author, aimed at people moving from plain Python loops to vectorised NumPy, with the reasoning that this repository omits. The two are complements rather than substitutes: numpy-100 is a checklist, the book is the instruction.

For Julia users, the README lists 100 Julia Exercises as a variant in another language. It is a separate repository by a different author, not a translation maintained here.

Licence, maintenance and the cost of regenerating

The work is under the MIT licence, and LICENSE.txt sits in the repository root. MIT is permissive: reuse, modification and redistribution are allowed with the licence and copyright notice retained. That is convenient for teachers who want to fold exercises into course material. It does not remove the obligation to keep the notice, and it says nothing about the provenance of individual exercises, which the README attributes to a mailing list, Stack Overflow and the documentation without itemising which exercise came from where. If you are republishing the set commercially, that attribution gap is the thing to look at, not the licence text. This is not legal advice.

The upgrade cost is low but not zero. There is no dependency lockfile, so regenerating with a newer mdutils or nbformat can change the output formatting, and the diff will be large and mostly noise. The sensible pattern is to regenerate only when you have actually edited source/exercises.ktx, and to review the resulting diff rather than committing it blind. Since the generated markdown is what most readers consume, a formatting change in the generator is a content change for them.

Editorial conclusion

Adopt rougier/numpy-100 if you already write Python and want a fixed set of problems to check which NumPy idioms you have never used; read the hints file first and the solutions file only after attempting each one. Do not adopt it as a structured course for beginners, because the README offers no ordering, no difficulty labels and no explanations beyond the code itself. Before relying on it, verify that the generated markdown in the repository matches what generators.py produces from source/exercises.ktx, since the README states the markdown and notebook files are generated programmatically and the source is the only thing meant to be edited.

Frequently asked questions

Can you provide me with 100 NumPy exercises?

Yes. The repository contains 100 exercises, published as markdown files in the repository root and as a Jupyter notebook, with separate variants that include hints, solutions, or both.

What is NumPy used for?

The repository does not explain what NumPy is for; it assumes the reader is working with it. The exercises themselves cover array creation, indexing, broadcasting and shape manipulation, and the README says the set is drawn from the numpy mailing list, Stack Overflow and the numpy documentation.

How do I run the numpy-100 exercises without installing anything?

The README links to a Binder badge that opens the notebook in a hosted environment, and offers a direct link to read the exercises on GitHub as 100_Numpy_exercises.md. No local install is needed for either route.

How do I change the content of the numpy-100 markdown files?

The README states the markdown and notebook files are generated programmatically from source/exercises.ktx, so you edit the ktx source and then run generators.py with a Python interpreter that has the libraries in requirements.txt installed.

Official sources

  1. Issues
  2. License: MIT
  3. README
  4. Releases
  5. rougier/numpy-100 on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/rougier-numpy-100.svg)](https://hysenlabs.com/projects/rougier-numpy-100)