completed the list of people who like a color and the number or people who like a color functions.

This commit is contained in:
Hope 2025-07-07 20:45:48 -04:00
parent 47d2723a0a
commit 847c416f3a
1 changed files with 3 additions and 2 deletions

View File

@ -54,7 +54,8 @@ def people_who_like_color(people, color):
>>> people_who_like_color(family, "indigo") >>> people_who_like_color(family, "indigo")
[] []
""" """
raise NotImplementedError() return [person for person in people if color in person.get("favorite_colors", [])]
def count_people_who_like_color(people, color): def count_people_who_like_color(people, color):
"""Returns the number of people who like a given color. """Returns the number of people who like a given color.
@ -64,7 +65,7 @@ def count_people_who_like_color(people, color):
>>> count_people_who_like_color(family, "orange") >>> count_people_who_like_color(family, "orange")
1 1
""" """
raise NotImplementedError() return len(people_who_like_color(people,color))
def get_color_dict(people): def get_color_dict(people):
"""Returns a dict showing how many people like each color. """Returns a dict showing how many people like each color.