The stationery shop keeps its stock in Stock, where self.items is {item: how many}. Finish add(name, count): if the item is already there, add to it; if not, start from 0.
stock_after([("pen", 10), ("glue", 2), ("pen", 5)])→{'pen': 15, 'glue': 2}stock_after([])→{}class Stock:
def __init__(self):
self.items = {}
def add(self, name, count):
# your code here: add count to how many of this item there were
pass
def stock_after(deliveries):
shop = Stock()
for name, count in deliveries:
shop.add(name, count)
return shop.items
Run tries the examples. When they look right, Submit.