From ed792e58ee8f13d05c2b299bba281d7ec3daaf46 Mon Sep 17 00:00:00 2001 From: Cory Dean Chung Date: Mon, 14 Aug 2023 14:43:21 -0400 Subject: [PATCH] 1 commit 5: Wrote count_people_who_like_color I didn't get stuck on this one :D --- friend_functions.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/friend_functions.py b/friend_functions.py index 2a3c313..1efb2e6 100644 --- a/friend_functions.py +++ b/friend_functions.py @@ -40,23 +40,6 @@ def count_favorite_colors(people, name): return None def people_who_like_color(people, color): - """Returns a list containing only those people who like the given color. - >>> people_who_like_color(family, "yellow") - [ - { - "name": "Walker Hurley", - "email": "auctor.odio@icloud.ca", - "favorite_colors": ["red", "yellow", "blue", "orange"], - }, - { - "name": "Clementine Joseph", - "email": "hendrerit@aol.co.uk", - "favorite_colors": ["yellow", "aqua", "black"], - } - ] - >>> people_who_like_color(family, "indigo") - [] - """ people_list = [] for person in people: for colors in person["favorite_colors"]: @@ -72,7 +55,11 @@ def count_people_who_like_color(people, color): >>> count_people_who_like_color(family, "orange") 1 """ - raise NotImplementedError() + people_liking_color = people_who_like_color(people,color) + people_count = 0 + for person in people_liking_color: + people_count = people_count + 1 + return people_count def get_color_dict(people): """Returns a dict showing how many people like each color.