PYTHON CIRCLE
Practice
Python Books
Archive
Subscribe
Login
Menu
Login
Practice
Python Books
Archive
Subscribe
Blog available for sell
This blog is available for sale. Please 'contact us' if interested.
Advertise with us
Python Multiple Choice Questions
Suppose d = {"john":40, "peter":45}, what happens when we try to retrieve a value using the expression d["susan"]?
A. Since "susan" is not a value in the set, Python raises a KeyError exception
B. It is executed fine and no exception is raised, and it returns None
C. Since "susan" is not a key in the set, Python raises a KeyError exception
D. Since "susan" is not a key in the set, Python raises a syntax error
Show Answer
Next Question
Correct Answer:
C
Explanation: Execute in the shell to verify.
© 2024-2025 Python Circle
Contact
Sponsor
Archive
Sitemap