Question #857

What is the output of the code snippet below?
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)


Comment on Disqus:

Question difficulty: 🔵🔵🔵🔵🔵


Similar questions: