
Exercise for reference:
Please update the dictionary by changing the second employee's last name from Smith to Smooth or whatever takes your fancy.
d = {"employees":[{"firstName": "John", "lastName": "Doe"},
{"firstName": "Anna", "lastName": "Smith"},
{"firstName": "Peter", "lastName": "Jones"}],
"owners":[{"firstName": "Jack", "lastName": "Petter"},
{"firstName": "Jessy", "lastName": "Petter"}]}Answer:
d['employees'][1]['lastName'] = "Smooth"
Explanation:
On the left side of the assignment operator, we are accessing Smith as we did in the previous exercise. Then using the assignment operator, we simply assign a new string to that item.