Function with type annotation
- We can add type-annotations to the function parameters and even to the return value.
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.