Created a function that returned a list so we had to start out with result to = [] and then work throught the dictionary to get the final output. Used the append command that was used in the scatter lab to create the list! created a for statement to help get the information we needed!

This commit is contained in:
erbrown
2025-12-13 20:42:22 -05:00
parent c8a5302ab4
commit f79959c5a4
2 changed files with 16 additions and 12 deletions

View File

@@ -64,7 +64,11 @@ def people_who_like_color(people, color):
>>> people_who_like_color(family, "indigo")
[]
"""
raise NotImplementedError()
result = []
for person in people:
if color in person["favorite_colors"]:
result.append(person)
return result
def count_people_who_like_color(people, color):
"""Returns the number of people who like a given color.