default parameter
Gives a parameter a default value.
Syntax
def name(x, y=default):
Description
If no argument is given at the call, the default is used; it lets you write flexible functions.
Example
Loading editor…
Expected output
Hello Alex Good morning Alex
When to use?
Optional settings, arguments that are the same most of the time.