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 #857
my_dict = {"a": 0,
"b": 1 + exit(0),
"c": 2}
print(my_dict["c"])
The Python interpreter will find the exit(0) function when it parses the code before executing print() and exit the program. Nothing will be printed. (help.semmle.com/wiki/pages/viewpage.action?pageId=29394142)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) April 13, 2021
my_dict = {"a": 0,
"b": 1 + exit(0),
"c": 2}
print(my_dict["c"])
0
2
Nothing will be printed.
It will throw a SyntaxError error.
π Comment the answer, like and retweet! #python
Question difficulty: π΅π΅π΅π΅π΅
Similar questions: