diff --git a/friend_functions.py b/friend_functions.py index ac05581..e9f84bf 100644 --- a/friend_functions.py +++ b/friend_functions.py @@ -64,8 +64,8 @@ def people_who_like_color(people, color): """ peoplelist=[] for person in people: - if color in person["favorite_color"]: - peoplelist.append(person["name"]) + if color in person["favorite_colors"]: + peoplelist.append(person) return peoplelist @@ -77,7 +77,8 @@ def count_people_who_like_color(people, color): >>> count_people_who_like_color(family, "orange") 1 """ - raise NotImplementedError() + peoplelist=people_who_like_color(people, color) + return len(peoplelist) def get_color_dict(people): """Returns a dict showing how many people like each color. @@ -96,7 +97,15 @@ def get_color_dict(people): "orange": 1, } """ - raise NotImplementedError() + listcolors=[] + for person in people: + listcolors.extend(person["favorite_colors"]) + dictcolors={} + for color in listcolors: + dictcolors[color]=count_people_who_like_color(people, color) + return dictcolors + +