Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- persons = dict()
- while True:
- try:
- person, product, count = input().split(" ")
- count = int(count)
- except: break
- if persons.get(person, None) is None:
- persons[person] = dict()
- if persons[person].get(product, None) is None:
- persons[person][product] = 0
- persons[person][product] += count
- p = list(persons.keys())
- p.sort()
- for a in p:
- print("{}:".format(a))
- l = list(persons[a].keys())
- l.sort()
- for d in l:
- print("{} {}".format(d, persons[a][d]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement