>A Byte of Python

Default Argument Values

For some functions, you may want to make some parameters as optional and use default values if the user does not want to provide values for such parameters. This is done with the help of default argument values. You can specify default argument values for parameters by following the parameter name in the function definition with the assignment operator (=) followed by the default argument.

Note that the default argument value should be immutable. This may not make much sense now but you will understand it when you come to the later chapters. Just remember that you have to use only immutable values and you cannot use mutable objects such as lists for default argument values.