Brainlag
  1. Python
  2. Advanced
32/42 lessons

Type hints

20 min6 exercisesPremium

Python type hints for beginners: annotate parameters, return values and variables, read list[int] and str | None, and know what hints do and do not do.

The skill
Write and read type hints, and know what they do and do not check.
You make
Hinted averages and lookups, and a function built from its signature alone.

Premium lesson

£7.99 a month or £59 a year. Cancel any time.

Builds on 31 Inheritance: classes built on classes. Free to try: Python Foundations and the playground.

Step 1 of 9
exercise_1.py

You've reached the good stuff.

6 exercises in this lesson, checked as you type. Premium opens every lesson after Foundations, in all four courses.

Python 3.13