7 lines
360 B
Python
7 lines
360 B
Python
sections = open("input", "r").read().split("\n\n")
|
|
sections = [section.replace("\n", " ") for section in sections]
|
|
passports = [dict([s.split(":") for s in section.split(" ") if s]) for section in sections]
|
|
required = {"byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"}
|
|
valid = [p for p in passports if len(required.difference(p.keys())) == 0]
|
|
print(len(valid))
|