0

How to complete the blanks to get the output:

red shirt
blue shirt 
white shirt
blue jeans
black jeans

Code:

wardrobe = {"shirt":["red","blue","white"], "jeans":["blue","black"]}
for __:
    for __:
        print("{} {}".format(__))
RoadRunner
  • 25,803
  • 6
  • 42
  • 75
Yahia Naeem
  • 63
  • 1
  • 2
  • 7
  • I've updated the question reflect the output you are seeking. – RoadRunner Mar 30 '20 at 03:58
  • Welcome to stackoverflow! :) Is this a homework question? Have you attempted any solutions? Are you stuck with understanding some specifics, or do you simply want someone to provide you the whole solution? – igr Mar 30 '20 at 09:10
  • 1
    Does this answer your question? [Iterating over dictionaries using 'for' loops](https://stackoverflow.com/questions/3294889/iterating-over-dictionaries-using-for-loops) – Cray Mar 30 '20 at 11:49

2 Answers2

2
for key in wardrobe:
    for color in wardrobe[key]:
        print("{} {}".format(color, key))
alec
  • 5,799
  • 1
  • 7
  • 20
2
wardrobe = {"shirt": ["red", "blue", "white"],
            "jeans": ["blue", "black"]}
for item, colors in wardrobe.items():
    for color in colors:
        print("{} {}".format(color, item))
dspencer
  • 4,297
  • 4
  • 22
  • 43