Report Bug

QusSuppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value using the expression d[“susan”]? Qusमान लीजिए कि d = {"जॉन": 40, "पीटर": 45}, तब क्या होता है जब हम एक्सप्रेशन का यूज़ करते हुए value प्राप्त करने का प्रयास करते हैं 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


Solution
C. Since “susan” is not a key in the set, Python raises a KeyError exception



Explanation
Execute in the shell to verify.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad