What this Python syntax and type-checking question tests
This is an easy question that probes your familiarity with Python language semantics and how static type checkers like mypy interpret them. It's the kind of question that separates candidates who read Python docs carefully from those who rely on intuition alone.
To answer it, you need to distinguish between what the Python runtime accepts as valid syntax and what a type checker will flag as an error. The two aren't always the same: code can be syntactically correct but still trigger a type-checking violation. Working through this question sharpens your understanding of the gap between dynamic and static analysis, and familiarises you with how modern Python tooling validates code before it runs.
- Python syntax rules and runtime validation
- Static type checking with mypy
- Differences between interpreter and type-checker behaviour