Advertisement
horozov86

A Miner Task

Mar 20th, 2023
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. resources = {}
  2.  
  3. while True:
  4.     line = input()
  5.     if line == "stop":
  6.         break
  7.  
  8.     quantity = int(input())
  9.     if line not in resources:
  10.         resources[line] = quantity
  11.  
  12.     else:
  13.         resources[line] += quantity
  14.  
  15. for resource, quantity in resources.items():
  16.     print(f"{resource} -> {quantity}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement