Python Quest

Track 13 · Lesson 11 of 12

Type hints and static checks

Document what functions accept and return with type hints, and let tools like mypy and ruff find bugs before the code runs.

About 40 minIntermediate3 exercises

You will be able to

  • Annotate parameters and return values with built-in and generic types
  • Use X | None for values that may be missing, and handle the None case
  • Explain what a static type checker such as mypy does and does not catch
  • Describe what a linter such as ruff checks and how teams use these tools alongside tests

Included with a Formula Quest membership

It has 3 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.