Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- dictionary_shells = {}
- while True:
- input_string = input()
- if input_string == "Aggregate":
- break
- input_list = input_string.split()
- region = input_list[0]
- size = [int(input_list[1])]
- if region in dictionary_shells:
- if size[0] in dictionary_shells[region]:
- continue
- else:
- dictionary_shells[region].append(size[0])
- else:
- dictionary_shells[region] = size
- for region in dictionary_shells:
- sum = 0
- for size in dictionary_shells[region]:
- sum = sum + size
- average = sum/len(dictionary_shells[region])
- if len(dictionary_shells[region]) == 1:
- giantshell = sum
- elif len(dictionary_shells[region]) > 1:
- giantshell = sum - average
- print(f"{region} -> ", end ="")
- print(*dictionary_shells[region], sep=", ", end ="")
- print(f" ({math.ceil(giantshell)})")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement