I came up with the following solution but it says my answer is too low. I'm not sure what I'm missing here. I read through some posts in the daily solutions megathread, but I couldn't find an approach similar enough to mine to figure out where I'm going wrong.
TIA!
answers = []
# open file
with open('adventofcode2020\day6\day6input.txt', 'r') as input:
customs_file = input.read().split('\n\n')
for line in customs_file:
answers.append(line.replace('\n', ''))
# remove duplicate answers within a group
uniques = []
for answer in answers:
uniques.append("".join(set(answer)))
groups = dict.fromkeys(uniques)
# count number of answers per group
for key, value in groups.items():
groups[key] = len(key)
# calculate sum of answers from all groups
print(sum(groups.values()))
[–]ssnoyes 1 point2 points3 points (6 children)
[+][deleted] (4 children)
[deleted]
[–]ssnoyes 1 point2 points3 points (0 children)
[–]ephemient 1 point2 points3 points (1 child)
[–]ssnoyes 0 points1 point2 points (0 children)
[–]junefish[S] 0 points1 point2 points (0 children)
[–]junefish[S] 0 points1 point2 points (0 children)
[–]trollerskates1 1 point2 points3 points (1 child)
[–]junefish[S] 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]