How to create nested Python dictionary?

PythonServer Side ProgrammingProgramming

A dictionary object is mutable. Hence one dictionary object can be used as a value component of a key. So we can create a nested dictionary object another dictionary object is defined as value associated with key.

>>> students={"student1":{"name":"Raaj", "age":23, "subjects":["Phy", "Che", "maths"],"GPA":8.5},"student2":{"name":"Kiran", "age":21, "subjects":["Phy", "Che", "bio"],"GPA":8.25}}
raja
Published on 29-Dec-2017 13:48:10
Advertisements