0
0
Fork 0

Add code for 2020 day 6.

This commit is contained in:
Oliver-Akins 2020-12-06 21:44:06 -07:00
parent 54601c8efa
commit 90d1031207
3 changed files with 36 additions and 0 deletions

19
day_6/part_2.py Normal file
View file

@ -0,0 +1,19 @@
with open("data") as f:
plane = f.read()
plane = plane.split("\n\n")
count = 0
for group in plane:
group_size = len(group.split("\n"))
group_answers = {}
for person in group.split("\n"):
for q in person:
if q not in group_answers:
group_answers[q] = 1
else:
group_answers[q] += 1
count += len([1 for v in group_answers.values() if v == group_size])
print(count)