How to do Quizzes with JupyterQuiz

code
analysis
Author

Alonso Silva

Published

June 16, 2025

TIL how to do quizzes with JupyterQuiz. JupyterQuiz is a tool to make quizzes in jupyter notebooks. It is very easy to use and you can even use it with WebAssembly as I will show below:

You can install jupyterquiz as follows:

Terminal
python -m venv .venv
source .venv/bin/activate
python -m pip install jupyterquiz
Terminal
uv venv
source .venv/bin/activate
uv pip install jupyterquiz
Terminal
%pip install jupyterquiz

Then you need to:

The expected format is as follows:

example = [
    {
        "question": "What is the capital of France?",
        "type": "multiple_choice",
        "answers": [
            {"answer": "London", "correct": False},
            {"answer": "Paris", "correct": True},
            {"answer": "New York", "correct": False},
            {"answer": "Rome", "correct": False},
        ],
    }
]

Then you can display the quiz:

from jupyterquiz import display_quiz

display_quiz(example)

You can also try it here by running the following cell:

You can also store the questions in a json file (in this case I’m storing it here) and then display the quiz:

Notice that we are not storing the results so this is only for people to get feedback when using these quizzes.

I like this simple way to do quizzes and I’m using them to motivate my kid to learn new things.