Advertisement
pacho_the_python

A Miner Task

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