Important Notice:

Course Content
Dictionary in Python (Chapter-9) M3-R5
About Lesson

Nested Dictionary:-

      Syntax:- {key:value, key:value, key:{key:value, key:value…….}}

student={‘reg’:14591,’name’:’ankit’,2:{‘reg’:14590,’name’:’sunil’}}

print(student)      # {‘reg’: 14591, ‘name’: ‘ankit’, 2: {‘reg’: 14590, ‘name’: ‘sunil’}}

print(student[‘reg’])                                              # 14591

print(student[‘name’])                                         # ankit

print(student[2])                                                   # {‘reg’: 14590, ‘name’: ‘sunil’}

print(student[2][‘reg’])                                         # 14590

print(student[2][‘name’])                                    #sunil

error: Content is protected !!