Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def print_shopping_list(dish1,dish2):
- a = set(dish1)
- b = set(dish2)
- spisok = a.union(b)
- for i in spisok:
- amount = 0
- if i in dish1:
- amount = dish1[i]
- if i in dish2:
- amount=dish1[i] + dish2[i]
- print( i + ':' + str(amount))
- # напишите здесь функцию print_shopping_list(),
- # подобрав уникальные названия продуктов и сложив значения
- pizza = {'мука, кг': 1,
- 'помидоры, кг': 1.5,
- 'шампиньоны, кг': 1.5,
- 'сыр, кг': 0.8,
- 'оливковое масло, л': 0.1,
- 'дрожжи, г': 50}
- salad = {'огурцы, кг': 1,
- 'перцы, кг': 1,
- 'помидоры, кг': 1.5,
- 'оливковое масло, л': 0.1,
- 'листья салата, кг': 0.4}
- print_shopping_list(pizza, salad)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement