Class 12 : Python Variable Function Arguments

Up until now functions had fixed number of arguments. In Python there are other ways to define a function which can take variable number of arguments.

Three different forms of this type are described below.

• Python Default Arguments
• Python Keyword Arguments
• Python Arbitrary Arguments

Python Default Arguments

Function arguments can have default values in Python.
We can provide a default value to an argument by using the assignment operator (=).


Python Keyword Arguments

Normally When we call a function with some values, these values get assigned to the arguments according to their position.


Python Arbitrary Arguments

Sometimes, we do not know in advance the number of arguments that will be passed into a function. Python allows us to handle this kind of situation through function calls with arbitrary number of arguments.
In the function definition we use an asterisk (*) before the parameter name to denote this kind of argument.