Asterisk and double asterisk

--

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.

* Can be used in the function call and in the function definition

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.

same with double asterisk **

Declaration: Portion of the examples are compiled from different [websites] (https://www.geeksforgeeks.org/use-yield-keyword-instead-return-keyword-python/).

--

--