5 Types of Arguments in Python Function Definitions
Learn about different types of arguments used in the python function definition
Published in
6 min readSep 2, 2020
5 Types of Arguments in Python Function Definition:
default arguments
keyword arguments
positional arguments
arbitrary positional arguments
arbitrary keyword arguments
Python Function Definition:
The function definition starts with the keyword
def
. It must be followed by the function name and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line and must be indented. — python docs
Formal parameters are mentioned in the function definition. Actual parameters(arguments) are passed during a function call.
We can define a function with a variable number of arguments.
1. default arguments:
- Default arguments are values that are provided while defining functions.
- The assignment operator
=
is used to assign a default value to the argument. - Default arguments become optional…