You are viewing a single comment's thread. Return to all comments →
from collections import OrderedDict N=int(input()) od=OrderedDict() for _ in range(N): line=input().split() item,price=' '.join(line[:-1]),int(line[-1]) od[item]=od.get(item, 0)+int(price) for item,price in od.items(): print(item,price)
Seems like cookies are disabled on this browser, please enable them to open this website
Collections.OrderedDict()
You are viewing a single comment's thread. Return to all comments →