Tidying the wardrobe, you note each piece as (item, color). Write by_color(clothes) to return {color: [items of that color]}, with colors and items in the order they came. No clothes gives {}.
by_color([("shirt", "blue"), ("socks", "red"), ("jeans", "blue")])→{'blue': ['shirt', 'jeans'], 'red': ['socks']}by_color([])→{}def by_color(clothes):
groups = {}
for item, color in clothes:
# your code here: give the color an empty list if it has none yet, then add the item
pass
return groups
Run tries the examples. When they look right, Submit.