You are viewing a single comment's thread. Return to all comments →
from collections import OrderedDict dic = OrderedDict() n = int(input()) for i in range(n): line = input().rsplit(" ", 1) item = line[0] price = int(line[1]) if item not in dic.keys(): dic[item] = price else: dic[item] += price for k, v in dic.items(): print(k, v)
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 →