More on How Function Arguments Work in Python

Learn about positional-only parameters and keyword-only arguments.

Positional-only parameters

Positional arguments (variable or not) are those that are provided first to functions in Python. The values for these arguments are interpreted based on the position they're provided to the function, meaning they're assigned respectively to the parameters in the function's definition.

If we don't make use of any special syntax when defining the function arguments, by default, they can be passed by position or keyword. For example, in the following function, all calls to the function are equivalent:

Get hands-on with 1200+ tech skills courses.