Learn to use *args
and **kwargs
in Python. *args
and **kwargs
allow us to pass variable length arguments to a function. Using *args
, we can pass any number of positional arguments and using **kwargs
, we can pass any number of key-value pairs to a function. These two parameters are really helpful when we have to create a function where we do not know how many arguments that function will have to receive for performing some action.
While passing the variables to the function that has *args
and **kwargs
as their parameters, we have to add *for
the variable that we want to be stored in args and we have to add **for
the variable that we want to be stored in kwargs.
Subscribe : https://www.youtube.com/channel/UC-FZ9Vs5uXEAwcmrOoKoCjA
#python