You are viewing a single comment's thread. Return to all comments →
I made it in 6 :
from collections import OrderedDict dic = OrderedDict() for _ in range(int(input())): item,price = input().rsplit(maxsplit=1) dic[item] = dic.get(item, 0) + int(price) print(*[f'{item} {dic[item]}' for item in dic.keys()], sep='\n')
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 →
I made it in 6 :