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

Default value in first param


def add(x=2, y):
    print("OK")

Output:

  File "default_first.py", line 2
    def add(x=2, y):
            ^
SyntaxError: non-default argument follows default argument