generated from mwc/lab_weather
Function 3 count_favorite_colors
Not sure what is going on here, but I was able to decipher the error message that it is not reading 0 for when the "favorite colors" list is empty. I'm just not sure what it is not reading 0 and I've tried a few other things too with the same result. Going to move on for now and come back to this later.
This commit is contained in:
parent
e4cb952f6f
commit
1631f47445
|
@ -41,7 +41,13 @@ def count_favorite_colors(people, name):
|
|||
>>> count_favorite_colors(family, "Raphael Chambers")
|
||||
1
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
for person in people:
|
||||
if person["name"]== name:
|
||||
colors = (person["favorite_colors"])
|
||||
return len(colors)
|
||||
|
||||
else:
|
||||
return "None"
|
||||
|
||||
def people_who_like_color(people, color):
|
||||
"""Returns a list containing only those people who like the given color.
|
||||
|
|
Loading…
Reference in New Issue