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
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