Use of double asterisk (**) in python
Mar 4, 2022
Introduction :
Double asterisk (**) is used for packing/unpacking a dictionary.
Flexibility provided by ** is that we can unpack or pack dictionary of any number of key-value pair.
Unpacking dictionary :
Packing dictionary :
To sum up:
In unpacking a dictionary, we need a predefined dictionary which is used as an input in a function and we get all the items unpacked.
In packing a dictionary, we create a dictionary using arguments as keys and values of arguments as values for a newly created dictionary.