You are viewing a single comment's thread. Return to all comments →
from collections import OrderedDict od = OrderedDict() for i in range(int(input())): item, price = input().rsplit(maxsplit=1) if item in od: od[item] += int(price) else: od[item] = int(price) for items, price in od.items(): print(items, price)
Collections.OrderedDict()
You are viewing a single comment's thread. Return to all comments →