diff options
author | Cody Hiar <cody@hiar.ca> | 2021-02-05 10:43:34 -0700 |
---|---|---|
committer | Cody Hiar <cody@hiar.ca> | 2021-02-05 10:43:34 -0700 |
commit | 3bb23093ae15aaa2b11c3b3d771d6a9e42b73a0c (patch) | |
tree | af03e0bb986a3bff0c76d5dfe9a949ac3b942e54 /day6/main.py | |
parent | b4a3bd52e5e610f431d9aa49e3ac0af918e1e344 (diff) |
day 7 part 1
Diffstat (limited to 'day6/main.py')
-rw-r--r-- | day6/main.py | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/day6/main.py b/day6/main.py deleted file mode 100644 index 7bad5d2..0000000 --- a/day6/main.py +++ /dev/null @@ -1,24 +0,0 @@ -"""Day 6.""" -from collections import Counter - - -def score_part1(group): - """Determine score for group in part 1.""" - return len(set(group.replace("\n", ""))) - - -def score_part2(group): - """Determine score for group in part 2.""" - group_size = group.count("\n") + 1 - counter = Counter(group.replace("\n", "")) - return sum(1 for _, occurences in counter.items() if occurences == group_size) - - -with open("input") as f: - groups = f.read().rstrip().split("\n\n") - -# Part 1 -print(sum(map(score_part1, groups))) - -# Part 2 -print(sum(map(score_part2, groups))) |