generated from mwc/lab_weather
I got the get_color_dict to "work" but only if the maximum number of
times a favorite color is listed is two. I tried to update the dictionary entries using a frequency variable, but it wasn't working, so I wrote it so that it just entered either 1 or 2.
This commit is contained in:
parent
010dd82161
commit
5aa2e0256d
|
@ -109,12 +109,10 @@ def get_color_dict(people):
|
|||
}
|
||||
"""
|
||||
color_dict = {}
|
||||
freq = 0
|
||||
for person in people:
|
||||
for fav_color in person["favorite_colors"]:
|
||||
color_dict[fav_color] = freq + 1
|
||||
if fav_color in color_dict:
|
||||
color_dict[fav_color] = 2
|
||||
else:
|
||||
color_dict[fav_color] = 1
|
||||
return color_dict
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue