May 2019
Beginner
528 pages
29h 51m
English
Functions with arbitrary argument lists, such as built-in functions min and max, can receive any number of arguments. Consider the following min call:
min(88, 75, 96, 55, 83)
The function’s documentation states that min has two required parameters (named arg1 and arg2) and an optional third parameter of the form *args, indicating that the function can receive any number of additional arguments. The * before the parameter name tells Python to pack any remaining arguments into a tuple that’s passed to the args parameter. In the call above, parameter arg1 receives 88, parameter arg2 receives 75 and parameter args receives the tuple (96, 55, 83).
Let’s define an ...
Read now
Unlock full access