Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. heroes = input().split(', ')
  2. info = {}
  3.  
  4. while True:
  5.     stuff = input()
  6.     if stuff == 'End':
  7.         break
  8.     tokens = stuff.split('-')
  9.     name = tokens[0]
  10.     item = tokens[1]
  11.     cost = int(tokens[2])
  12.     if name not in info:
  13.         info[name] = [[item], cost]
  14.     elif item not in info[name][0]:
  15.         info[name][0].append(item)
  16.         info[name][1] += cost
  17.  
  18. [print(f'{hero} -> Items: {len(info[hero][0])}, Cost: {info[hero][1]}') for hero in heroes]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement