Python function (advanced): What is a default argument?
The following is typical in Python.
def f(x): print(x) f('book') # book
In Python, you can set the default argument in function.
def f(x='pen'): print(x) f('book') # book f() # pen
pen is the defualt argument of function
f. If you set x
book is printed. If you set x nothing,
pen is printed because the default value of x is
Most Python codes, built-in functions, modules, libs use the defualt argument in defining functions.