You are viewing a single comment's thread. Return to all comments →
Here is Python 3 solution from my HackerrankPractice repository:
from collections import OrderedDict ordered_dictionary = OrderedDict() for _ in range(int(input())): item, price = input().rsplit(' ', 1) ordered_dictionary[item] = ordered_dictionary.get(item, 0) + int(price) [print(item, ordered_dictionary[item]) for item in ordered_dictionary]
Feel free to ask if you have any questions :)
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 →
Here is Python 3 solution from my HackerrankPractice repository:
Feel free to ask if you have any questions :)