Suppose D 8220john822140 8220peter822145 What Happens When We #556
Suppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value using the expression d[“susan”]?
This multiple choice question (MCQ) is related to the book/course gs gs109 Python. It can also be found in gs gs109 Python Dictionary - Python Dictionary - Quiz No.1.
Suppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value using the expression d[“susan”]?
Since “susan” is not a value in the set, Python raises a KeyError exception
It is executed fine and no exception is raised, and it returns None
Since “susan” is not a key in the set, Python raises a KeyError exception
Since “susan” is not a key in the set, Python raises a syntax error