# Type Hints — Python Fundamentals: From Basics to Async

Source: https://www.skillbyai.com/en/python/py-type-hints

> Add optional type hints to document intent and let mypy and editors catch bugs before runtime.

## Annotating functions

Type hints don't change runtime behaviour — Python ignores them at execution — but editors and tools like `mypy` use them to catch mistakes before you run the code.

```python
def greet(name: str, times: int = 1) -> str:
    return (f"Hi, {name}! " * times).strip()

age: int = 25
scores: list[int] = [90, 85, 78]
```

## Why bother?

Type hints are especially valuable on public function signatures and large codebases — they act as always-up-to-date documentation.
