One fuction was supposed to bring all the information about person, not just name. Email and color need to be shown too. So, I fixed this.

This commit is contained in:
Seoyeon Lee 2024-12-06 23:56:56 -05:00
parent 619c975e65
commit da71a110e4
1 changed files with 13 additions and 4 deletions

View File

@ -64,8 +64,8 @@ def people_who_like_color(people, color):
""" """
peoplelist=[] peoplelist=[]
for person in people: for person in people:
if color in person["favorite_color"]: if color in person["favorite_colors"]:
peoplelist.append(person["name"]) peoplelist.append(person)
return peoplelist return peoplelist
@ -77,7 +77,8 @@ 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() peoplelist=people_who_like_color(people, color)
return len(peoplelist)
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.
@ -96,7 +97,15 @@ def get_color_dict(people):
"orange": 1, "orange": 1,
} }
""" """
raise NotImplementedError() listcolors=[]
for person in people:
listcolors.extend(person["favorite_colors"])
dictcolors={}
for color in listcolors:
dictcolors[color]=count_people_who_like_color(people, color)
return dictcolors