nested dictionarys code example
Example 1: Nested dictionary Python
IDs = ['emp1','emp2','emp3']
EmpInfo = [{'name': 'Bob', 'job': 'Mgr'},
{'name': 'Kim', 'job': 'Dev'},
{'name': 'Sam', 'job': 'Dev'}]
D = dict(zip(IDs, EmpInfo))
print(D)
Example 2: how to nested dictonary that condition
people = {1: {'name': 'John', 'age': '27', 'sex': 'Male'},
2: {'name': 'Marie', 'age': '22', 'sex': 'Female'}}
people[3] = {}
people[1]['name'] = 'Luna'
people[1]['age'] = '24'
people[1]['sex'] = 'Female'
people[1]['married'] = 'No'
print(people[1])