Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- command = input()
- shells_area = {}
- new_dict = {}
- result = 0
- while not command == "Aggregate":
- city, shell_size = [item for item in command.split(" ")]
- if not city in shells_area:
- shells_area[city] = [shell_size]
- else:
- if shell_size not in shells_area[city]:
- shells_area[city].append(shell_size)
- sum_shells = sum(list(map(int, shells_area[city])))
- count_shells = len(shells_area[city])
- result_shels = math.ceil(sum_shells -(sum_shells / count_shells))
- new_dict[city] = result_shels
- command = input()
- for key, value in shells_area.items():
- print(f"{key} -> {', '.join(value)} ({new_dict[key]})")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement