generated from mwc/lab_weather
I got the count_people_who_like_color function to work.
I was trying to check if a color was in the list using
if person["favorite_colors"] == color
but then I figured that if it was just one color in a list of colors it
wouldn't work.
This commit is contained in:
@@ -81,7 +81,11 @@ 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()
|
how_many_like_color = 0
|
||||||
|
for person in people:
|
||||||
|
if color in person["favorite_colors"]:
|
||||||
|
how_many_like_color = how_many_like_color + 1
|
||||||
|
return how_many_like_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.
|
||||||
|
|||||||
Reference in New Issue
Block a user