aneliabogeva

10. Shellbound

Jul 8th, 2019
153
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import math
  2.  
  3. command = input()
  4. shells_area = {}
  5. new_dict = {}
  6. result = 0
  7.  
  8. while not command == "Aggregate":
  9. city, shell_size = [item for item in command.split(" ")]
  10. if not city in shells_area:
  11. shells_area[city] = [shell_size]
  12. else:
  13. if shell_size not in shells_area[city]:
  14. shells_area[city].append(shell_size)
  15. sum_shells = sum(list(map(int, shells_area[city])))
  16. count_shells = len(shells_area[city])
  17.  
  18. result_shels = math.ceil(sum_shells -(sum_shells / count_shells))
  19. new_dict[city] = result_shels
  20. command = input()
  21.  
  22. for key, value in shells_area.items():
  23. print(f"{key} -> {', '.join(value)} ({new_dict[key]})")
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×