= [
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},
{
],
} ]
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:
- Provide a question (in this example “What’s the capital of France?”),
- Specify what’s the type of question you want to make (“multiple_choice”, “many_choice”, etc.),
- and finally the possible answers and which one(s) are correct.
The expected format is as follows:
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.