Skip to content

Latest commit

 

History

History
 
 

README.md

Build a Quiz Application With Python

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.

Dependencies

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/activate

You can then install tomli with pip:

(venv) $ python -m pip install tomli

If 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.

Run the Quiz

Enter one of the source_code_... folders. You can then run the quiz by running quiz.py as a script:

(venv) $ python quiz.py

Check 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.

Author

License

Distributed under the MIT license. See LICENSE for more information.