The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #138
def foo(**kwargs):
return kwargs
foo(1)
A the function is only given the **kwargs parameter, it doesn't expect positional arguments (arguments without keywords). However, as 1 is passed as a positional argument, a TypeError will be thrown. (docs.python.org/dev/tutorial/controlflow.html#more-on-def...)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) June 25, 2020
def foo(**kwargs):
return kwargs
foo(1)
1
It will throw a TypeError.
(1)
{1}
[1]#python #python3 #pythonprogramming #learnpython
Question difficulty: π΅π΅π΅π΅π΅
Similar questions: