Advent of Code day 4
In day 4 we count valid passports, i.e. passports that have all the required fields.In solving it, we have to decide how complex to be. The first part doesn’t require much complexity -- we could just search each passport for ‘byr:’, ‘iyr:’, etc. ...
pyetc.hashnode.dev7 min read
Excellent work. I thought this problem demanded more legwork than other days. And those line breaks! (I used Vim, to remove single newlines and reduce doubles to a single).
For the "chain of ands" problem, I tried something like:
def check_validity(passport) keys=["byr:","iyr:","eyr:","hgt:","hcl:","ecl:","pid:"] for test in keys: if test in passport: pass else: return False return True