English

Consider the following dictionary stateCapital: stateCapital = {"AndhraPradesh":"Hyderabad", "Bihar":"Patna","Maharashtra":"Mumbai", "Rajasthan":"Jaipur"} Find the output of the following statement - Computer Science (Python)

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.keys())
One Line Answer

Solution

dict_keys(['AndhraPradesh', 'Bihar', 'Maharashtra', 'Rajasthan']): 'keys()' function returns the list of the keys in the dictionary.

shaalaa.com
Manipulating Dictionaries
  Is there an error in this question or solution?
Chapter 10: Tuples and Dictionaries - Exercise [Page 224]

APPEARS IN

NCERT Computer Science [English] Class 11
Chapter 10 Tuples and Dictionaries
Exercise | Q 2. ii. | Page 224
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×