• Slider Banner

    The Programming World

    Learn about top programming languages, tools and frameworks.

    Read more
  • Slider Banner

    Certification MCQ

    Practice for certification from 1000+ multiple choice questions.

    Read more
  • Slider Banner

    Prepare for Technical Interview

    Over 1 Million+ interview questions for different technical profiles.

    Read more

Using keys and indexing, grab the word 'hello' from the following dictionaries:

Dictionaries:

dict1 = {'k1':'hello'}
dict2 = {'k1':{'k2':'hello'}}
dict3 = {'k1':[{'k2':['k3',['hello']]}]}
dict4 = {'k1':[1,2,{'k2':['k3',{'k4':[1,2,['hello']]}]}]}

Output:

dict1['k1']
dict2['k1']['k2']
dict3['k1'][0]['k2'][1][0] 
dict4['k1'][2]['k2'][1]['k4'][2][0]

 

Subscribe to