Coding Exercise #13
🌶️
👉 Charlie works for Microsoft. Use chain indexing to access and then print out the age of Charlie:
microsoft = {
'Engineering': {
'team1': {
'members': [
{'name': 'Alice', 'role': 'Engineer', 'age': 30},
{'name': 'Bob', 'role': 'Senior Engineer', 'age': 35}
],
'projects': ['Project A', 'Project B']
},
'team2': {
'members': [
{'name': 'Charlie', 'role': 'Engineer', 'age': 28},
{'name': 'David', 'role': 'Lead Engineer', 'age': 40}
],
'projects': ['Project C']
}
},
'HR': {
'team1': {
'members': [
{'name': 'Grace', 'role': 'HR Specialist', 'age': 27},
{'name': 'Hank', 'role': 'HR Manager', 'age': 38}
]
}
}
}Press the button below to go to the code editor:
Use the button below to see the solution:
Subscribe below to get a new Python project or exercise daily or upgrade to our paid plan to view the archive of projects, exercises, and solutions.



charlie_age = microsoft['Engineering']['team2']['members'][0]['age']
print(charlie_age)