Skip to content

Instantly share code, notes, and snippets.

@ShaswatPrabhat
Created December 6, 2020 06:14
Show Gist options
  • Save ShaswatPrabhat/09ee916aa756c4a9fa364658e8ab732f to your computer and use it in GitHub Desktop.
Save ShaswatPrabhat/09ee916aa756c4a9fa364658e8ab732f to your computer and use it in GitHub Desktop.
Day 6 solution for AOC 20
answers = open('input_test.txt').read().replace('\r\n', '\n').replace('\n\n', '|').replace('\n', ' ').split('|')
part1 = 0
part2 = 0
for answer in answers:
part1 += len(set(answer.replace(' ', '')))
part2 += len(set.intersection(*map(set, answer.split())))
print(answer, '--->', list(map(set, answer.split())))
print(f'Part 1: {part1}, Part 2: {part2}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment