Define a function that accepts and outputs arguments
def func(x, y, z):
print(x, y, z)
Define two arguments in succession with tuple and dict
#tuple type
tuple_arg = (1, 0, 1)
#dict type
dict_arg = {'x': 1, 'y': 0, 'z': 1}
When I pass tuple as an argument of the function func
func(*tuple_arg)
>>> 1, 0, 1
When I pass dict to the argument of the function func
func(**dict_arg)
>>> 1, 0, 1
In both cases, it recognizes the argument and expands the value from the passed type.
Recommended Posts