September 2026
1051 pages
35h 4m
English
Recall again the use of the built-in print function:
>>> print("P")P>>> print("P", "y", "t", "h", "o", "n")P y t h o n>>> print("P", "y", "t", "h", "o", "n", " ", "i", "s", " ",... "g", "r", "e", "a", "t")P y t h o n i s g r e a t
Obviously, it’s possible to pass any number of arguments to the print function. This property isn’t exclusive to the print function: you can also define your own functions that can be passed any number of arguments.
For both forms of argument passing (positional and keyword), there is a notation that allows a function to accept any number of arguments. Let's continue to look at positional arguments for now. Consider the following function definition:
>>> def function(a, b, *other): ...
Read now
Unlock full access