r/backtickbot • u/backtickbot • Dec 06 '20
https://np.reddit.com/r/adventofcode/comments/k7ndux/2020_day_06_solutions/ges7qbm/
Python 3 - Part 1
inp= open('input').read().rstrip()
alpha = ["a","b","c","d", "e","f", "g", "h", "i", "j","k", "l","m","n","o","p","q","r","s", "t","u","v","w","x","y","z"]
s = 0
inpu = inp.split("\n\n")
for x in inpu:
tot = sum(1 for y in alpha if y in x)
s +=tot
print(s)Part 2
inp= open('input').read().rstrip()
alpha = ["a","b","c","d", "e","f", "g", "h", "i", "j","k", "l","m","n","o","p","q","r","s", "t","u","v","w","x","y","z"]
s = 0
inpu = inp.split("\n\n")
for x in inpu:
line = x.split("\n")
for letter in alpha:
if all([letter in z for z in line ]):
s+=1
print(s)
1
Upvotes