Advertisements
Advertisements
Question
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(stateCapital.get("Bihar"))
One Line Answer
Solution
Patna: 'get()' function returns the value corresponding to the key passed as an argument.
shaalaa.com
Dictionary Methods and Built-in Functions
Is there an error in this question or solution?
Chapter 10: Tuples and Dictionaries - Exercise [Page 224]
APPEARS IN
RELATED QUESTIONS
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(stateCapital.values())
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(stateCapital.items())
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(len(stateCapital))
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
print(stateCapital.get("Assam"))
Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad",
"Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statement:
del stateCapital["Rajasthan"]
print(stateCapital)