Advertisements
Advertisements
Question
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
del stateCapital["Assam"]
print(stateCapital)Very Short Answer
Advertisements
Solution
KeyError: 'Assam'
Because "Assam" is not present in the dictionary, the del statement gives an error, and print(stateCapital) is not executed.
shaalaa.com
Is there an error in this question or solution?
