English · Dansk · Bahasa Melayu
Pretty Table
A console program that prints a table of Pokémon and their types with the PrettyTable package.
What is it?
Day 16 of the Udemy course 100 Days of Code: The Complete Python Pro Bootcamp, the assignment about adding Python packages from PyPI. The function create_table builds a PrettyTable with the columns Pokemon Name and Type, and main prints it. The rows are Pikachu (Electric), Squirtle (Water) and Charmander (Fire). PrettyTable is the only runtime dependency.
What the exercise teaches
- Installing and importing a package from PyPI, the Python Package Index
- Declaring a runtime dependency in
pyproject.toml
- Building a table with the
PrettyTable class
- Writing automated pytest tests, and running a linter and a strict type checker
What it does
- A table of Pokémon names and types printed as text
- The assignment's function names
create_table and main
- Column titles and rows kept in constants
- Run as
python -m pretty_table or with the pretty-table command
Next