Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Infer (deduct) the type

  • We can define every variable, but in many cases Python will infer them from other definitions.

def add(x: int, y: int) -> int:
    return x + y

def display(text: str):
    print(text)


first = 19
second = 23
result = add(first, second)
display(result)