Type hints
A type hint is a label you write next to a name to say what kind of value it should hold, without Python enforcing it.
Used in 97 lessons of the course, from 00.01.
A type hint (or type annotation) says what kind of value is expected. You write it with a colon after the name: age: int. In a function, parameters take name: type and the result goes after ->.
Python does not check them at runtime. They are for people, your editor, and tools like mypy, which warn you about mistakes before you run the code. So they document intent without changing behavior.
You can describe containers with brackets: list[str] is a list of strings and dict[str, int] is a dict with string keys and integer values.
In the course you will see lines like GLOSSARY: dict[str, tuple[str, str]] = {. Read it as: GLOSSARY is a dict whose keys are strings and whose values are tuples of two strings. Reading them tells you the shape of the data before you see its contents.
Reach for it when: you want the expected type of a parameter, a result, or a variable to be clear to readers and to your editor.
Examples
Common mistake
x: int = "hola" print(x)
Why: Python does not check hints at runtime, so it accepts a string even though you said `int`.
How to write it: Assign a value of the declared type, and use a checker like mypy or your editor to catch these slips.
