You are viewing a single comment's thread. Return to all comments →
from collections import OrderedDict,defaultdict dictionary = defaultdict(int) N = int(input()) for i in range(N): name,price = input().rsplit(" ",1) dictionary[name] += (int(price)) order = OrderedDict(dictionary) for keys in order: print(keys,order[keys])
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 →