๐ Modern Python
Type Hints
Annotate function signatures for clarity and tooling.
Type hints don't change runtime behavior โ they document intent and power editor autocomplete and static checkers like mypy.
def greet(name: str, times: int = 1) -> str:
return ("hi " + name + " ") * times
Use list[int], dict[str, float], Optional[X] (or X | None) for richer types.