You are viewing a single comment's thread. Return to all comments →
from collections import OrderedDict if __name__=="__main__": od=OrderedDict() for i in range(int(input())): item,price=input().rsplit(' ',1) od[f'{item}']=od[f'{item}']+int(price) if item in od else int(price) for i in od: print(i,od[f'{i}'])
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 →