diff --git a/friend_functions.py b/friend_functions.py index 25275c8..c4741f0 100644 --- a/friend_functions.py +++ b/friend_functions.py @@ -83,7 +83,11 @@ def count_people_who_like_color(people, color): >>> count_people_who_like_color(family, "orange") 1 """ - raise NotImplementedError() + like_color2 = [] + for person in people: + if color in person["favorite_colors"]: + like_color2.append(person["name"]) + return len(like_color2) def get_color_dict(people): """Returns a dict showing how many people like each color. @@ -118,4 +122,7 @@ favcolor = count_favorite_colors(friends, "Yulix Reynolds") print ("# of fav colors is", favcolor) like_color = people_who_like_color(family, "aqua") -print("People who like red:", like_color) \ No newline at end of file +print("People who like red:", like_color) + +count_color = count_people_who_like_color(friends, "red") +print("# who like red:", count_color) \ No newline at end of file