0

The code:

params = {'shift' : 'day',
                'item_served': 'enchiladas',
                'item_served': 'sushi',
                'item_served': 'polenta'}

for key, value in params.items():
    print(key)
    print(value)

Currently outputs:

shift
day
item_served
polenta

But this is what I'm looking for:

shift
day
item_served
enchiladas
item_served
sushi
item_served
polenta

How do you modify the code so that the entries with duplicate keys but different values are not overwritten?

lespaul
  • 477
  • 2
  • 8
  • 21

0 Answers0