Function with type annotation
- We can add type-annotations to the function parameters and even to the return value.
examples/python-types-at-pyweb-2025-01/function_with_type.py
def add(x: int, y: int) -> int: return x + y print("ok") first = "19" second = 23 print(add(first, second))
- However, Python will disregard these type-annotations and we still get a run-time exception.