Back Navigation Next Navigation Video 9: Args and Kwargs (page 2 of 3)

In Python, we can pass a variable number of arguments to a function.

An *args (denoted with the single asterisk) parameter allows us to take in more arguments than the number of parameters in the function header. With *args, any number of extra arguments (if any) can be packaged in a parameter that is a tuple.

A **kwargs (denoted with a double asterisk) parameter in a function header is used to accept a keyword, variable-length argument list. A keyword argument is where we provide a name to the variable as we pass it into the function. kwargs works like a dictionary that maps each keyword (key in the dictionary) to the value (value in the dictionary) that we pass alongside it.