Default values and named parameters (Python 3 )
Default values and named parameters
A compelling Python feature is the ability to provide default values for the parameters.
Because our parameters have a default value, you don't have to fill them in. If you don't, the default is used. If you do, you override the default with your own value.
Calling Python functions while explicitly naming the parameters is different from what we did up until now. These parameters are called named parameters because we specify both the name and the value, instead of just the value. Thanks to these named parameters, the order in which we supply them don't matter. If you think about it, it's the natural and only way to make default values useful.
Edit and run this Python 3 example code
This code is editable and runnable. You can run "Default values and named parameters" by pressing the run button.
It will be executed in our backend and the result (
stderr) is displayed
in addition tabs.