Skip to content

Commit 1ecdbad

Browse files
committed
Add solution part two
1 parent d2e46c5 commit 1ecdbad

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Day-06/python/paul2708/solution.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from assertions import assert_equals
2-
from input_reader import read_lines, read_split_lines
2+
from input_reader import read_split_lines
33
from printer import aoc_print
44

55
groups = read_split_lines("day06")
@@ -18,3 +18,17 @@
1818
assert_equals(6714, total_sum)
1919

2020
# Part two
21+
total_sum = 0
22+
for group in groups:
23+
votes = list()
24+
25+
for single_person in group:
26+
for question in single_person:
27+
votes.append(question)
28+
29+
for vote in set(votes):
30+
if votes.count(vote) == len(group):
31+
total_sum += 1
32+
33+
aoc_print(f"The count of 'yes' votes in every group is {total_sum}.")
34+
assert_equals(3435, total_sum)

0 commit comments

Comments
 (0)