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:
parent
847c416f3a
commit
f8a089f6e6
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue