Type annotations
Notes in the code saying what type each parameter, return value or name is meant to have, so that people and tools know what a function wants and gives back.
Depth 1 · Foundation
You can read and write a function's signature with types (`rate: float`, `-> str`, `-> None`), and you know Python stores annotations but doesn't check them while it runs.
Sign in to prove what you know with a short quiz, see how deep you've gone, and earn XP for it.
Sign in with GoogleDepths of understanding
- 1
Foundation
You can read and write a function's signature with types (`rate: float`, `-> str`, `-> None`), and you know Python stores annotations but doesn't check them while it runs.
- 2
Deeper
You can describe the shape of collections in a type (`list[int]`, `dict[str, list[int]]`, `tuple[int, int]`) and use a union like `int | None` for a value that may be missing, so a checker makes every caller handle it.
Master depth 1 first
Your path here
What's still between you and Type annotations, depth 1, in the order you can learn it.
- 1ProgramDepth 1 · Foundation · Program Basics
- 2ExpressionDepth 1 · Foundation · Program Basics
- 3Variables in codeDepth 1 · Foundation · Program Basics
- 4Program stateDepth 1 · Foundation · Program Basics
- 5Input and outputDepth 1 · Foundation · Program Basics
- 6Functions in codeDepth 1 · Foundation · Functions
- 7Return valuesDepth 1 · Foundation · Functions
- 8BooleansDepth 1 · Foundation · Control Flow
- 9ConditionalsDepth 1 · Foundation · Control Flow
- 10LoopsDepth 1 · Foundation · Control Flow
- 11Accumulator patternDepth 1 · Foundation · Control Flow
- 12Floating-point numbersDepth 1 · Foundation · Data Types
- 13Basic typesDepth 1 · Foundation · Data Types
- 14Character encodingDepth 1 · Foundation · Data Types
- 15StringsDepth 1 · Foundation · Data Types
- 16Type conversionDepth 1 · Foundation · Data Types
- 17ExceptionsDepth 1 · Foundation · Writing Correct Code
- 18NoneDepth 1 · Foundation · Data Types
- 19ListsDepth 1 · Foundation · Data Structures
- 20DictionariesDepth 1 · Foundation · Data Structures
- 21Type annotationsDepth 1 · Foundation · Writing Correct Code