21 lines
442 B
Python
21 lines
442 B
Python
#!/usr/bin/env python
|
|
|
|
|
|
passport_req = {'byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid'}
|
|
passport = []
|
|
|
|
valid = 0
|
|
with open("input01.txt","r") as f:
|
|
for line in f:
|
|
line = line.strip()
|
|
if len(line) == 0:
|
|
if len(passport_req.difference(set(passport))) == 0:
|
|
valid += 1
|
|
passport=[]
|
|
continue
|
|
passport += [x.split(":")[0] for x in line.split(" ")]
|
|
|
|
if len(passport_req.difference(set(passport))) == 0:
|
|
valid += 1
|
|
|
|
print(valid) |