β All terms Β· Syntax
Type hints
Annotations that describe expected types: `def f(x: int) -> str:`. Not enforced at runtime β used by tools like mypy.
def greet(name: str) -> None: ...
Learn this interactively:
Open lesson lesson-101 βRelated β Syntax
f-stringAn f-prefixed string literal that lets you inline expressions: `f"x={x}"`. Introβ¦Walrus operator`:=` assigns inside an expression. Useful when you'd otherwise compute the same β¦Truthy / falsyValues that act as True / False in `if` statements. Empty containers, `0`, `Noneβ¦SlicingSubstring/sublist via `s[start:stop:step]`. Negative indices count from the end.Match statementStructural pattern matching (PEP 634, Python 3.10+). `match val: case Point(x, yβ¦