generated from mwc/lab_weather
completed the last function. I had to use AI for help on syntax for adding to a count.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user