completed the last function. I had to use AI for help on syntax for adding to a count.

This commit is contained in:
Hope 2025-07-07 21:07:00 -04:00
parent 847c416f3a
commit f8a089f6e6
1 changed files with 8 additions and 1 deletions

View File

@ -84,7 +84,14 @@ def get_color_dict(people):
"orange": 1,
}
"""
raise NotImplementedError()
fav_color_dict = {}
for person in people:
for color in person.get("favorite_colors", []):
if color in fav_color_dict:
fav_color_dict[color] += 1
else:
fav_color_dict[color] = 1
return fav_color_dict