What is the output of the following Python code snippet?
def f(**kwargs):
return kwargs
print(f(a=1, b=2))
return kwargs
print(f(a=1, b=2))
Correct answer
D. {'a': 1, 'b': 2}
5 views
D. {'a': 1, 'b': 2}
5 views
**kwargs collects extra keyword arguments into a dictionary.
Asked in: Python Interview Functions
https://docs.python.org/3/tutorial/controlflow.html#defining-functionsNot sure why the answer is D? Ask here and get an explanation.