I am trying to understand the difference between *args and **args in function definition in python. In the below example, *args works to pack into a tuple and calculate the sum.
>>> def add(*l):
... sum = 0
... for i in l:
... sum+=i
... return sum ...
>>> add(1,2,3)
6
>>> l = [1,2,3]
>>>add(*l)
6
for ** args,
>>> def f(**args):
... print(args)
...
>>> f()
{}
>>> f(de="Germnan",en="English",fr="French")
{'fr': 'French', 'de': 'Germnan', 'en': 'English'}
>>>
I see that it takes parameters and turns into a dictionary. But I do not understand the utility or other things that could be helpful when using ** args. In fact, I dont know what *args and **args are called(vararg and ?)
Thanks