deushiro

Untitled

Apr 1st, 2021
839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. s = " "
  2. people = {}
  3. while(True):
  4.     s = input().split()
  5.     if(len(s) < 2):
  6.         break
  7.     client = s[0]
  8.     product = s[1]
  9.     num = int(s[2])
  10.     if(client not in people):
  11.         people[client] = {}
  12.     if(product not in people[client]):
  13.         people[client][product] = num
  14.     else:
  15.         people[client][product] += num
  16. for i in people:
  17.     print(i + ":")
  18.     for j in people[i]:
  19.         print(j, people[i][j])
  20.    
  21.  
Advertisement
Add Comment
Please, Sign In to add comment