Asterisk and double asterisk
Feb 6, 2021
The asterisk * and ** operator can come in two places
1. Inside function definition → Variable # of args converted as list
2. Inside function call → list converted to function arguments
The examples are pretty straightforward and understandable.
The double asterisk operator ** also serves a similar purpose but unlike * which converts between (list <-> arguments), ** converts between (dict <-> keyword arguments). An example is given below.
Declaration: Portion of the examples are compiled from different [websites] (https://www.geeksforgeeks.org/use-yield-keyword-instead-return-keyword-python/).