This repository holds the code for the Real Python Build a Quiz Application With Python tutorial.
The tutorial uses the walrus operator, which was introduced in Python 3.8. The source_code_final_37 directory shows a quiz application version that doesn't use the walrus operator and runs on Python 3.7.
If you're running on Python 3.10 or earlier, then you need to install tomli which is used to read TOML data files. You should first create a virtual environment:
$ python -m venv venv
$ source venv/bin/activateYou can then install tomli with pip:
(venv) $ python -m pip install tomliIf you're running Python 3.11 or later, then tomllib provides TOML support in the standard library. In this case, you don't need to create a virtual environment or install any third-party dependencies.
Enter one of the source_code_... folders. You can then run the quiz by running quiz.py as a script:
(venv) $ python quiz.pyCheck out the questions.toml file for a list of the questions that are available (in step 4 and later). Edit this file to add your own questions.
- Geir Arne Hjelle, E-mail: [email protected]
Distributed under the MIT license. See LICENSE for more information.