You are viewing a single comment's thread. Return to all comments →
from collections import OrderedDict n = int(input()) item_list = OrderedDict() for _ in range(n): item = input().split() key = ' '.join(item[:-1]) value = int(item[-1]) item_list[key] = item_list.get(key,0)+value for k,v in item_list.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 →