Stage 2

Stage 2: Intermediate

Goal: Write well-organised, tested Python programs that use classes, talk to web APIs and store data in a database. Time: about 2 weeks at ~1 hour a day (~12โ€“14 hours including the project) ยท Level: you have finished Stage 1


Parts in this stage

Do them in order. Each part builds on the ones before it. When a later topic shows up early, it is marked with a note like (Part 11).

Part Topic You will build Time
9 Object-oriented Python Bank account system ~1 h
10 Pythonic and functional Python Log-processing pipeline ~1 h
11 Testing and code quality A fully tested grade calculator ~1 h
12 Web, APIs and databases Weather report with SQLite ~1 h
๐Ÿ Project: Library manager Command-line library system: OOP + SQLite + tests ~8โ€“10 h

How every part is organised

part-NN-topic/
โ”œโ”€โ”€ README.md      โ† 1. read the lesson
โ”œโ”€โ”€ examples/      โ† 2. run the example programs
โ”œโ”€โ”€ exercises.md   โ† 3. solve the practice questions yourself
โ”œโ”€โ”€ solutions/     โ† 4. only then compare with the solution
โ””โ”€โ”€ tests/         โ† (Part 11 and the project) automated tests run with pytest

How to study each part

  1. Read the part's README.md. Type the snippets yourself.
  2. Run each file in examples/, then change something and run it again.
  3. Solve exercises.md in order: ๐ŸŸข easy โ†’ ๐ŸŸก medium โ†’ ๐Ÿ”ด challenge.
  4. Check your answer against solutions/ only after you have tried.
  5. Tick the โœ… checklist at the end of the part.

๐Ÿ’ก Already experienced? Skim the beginner text and look for the ๐Ÿ” Going deeper notes.

How to run the code

python3 stage-2-intermediate/part-09-object-oriented-python/examples/07_bank_account_system.py

On Windows, use python (or py) instead of python3.

Packages: Parts 9, 10 and 12 use only the standard library. Part 11 and the project use pytest. Install it once in a virtual environment (Part 7):

python3 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install pytest

Stage 2 checklist

Next: ๐Ÿ”ด Stage 3: Advanced (concurrency, internals, advanced typing, packaging)

Search the guide