Files
AdventOfCode_2020/Scripts/Day4_1.py
2020-12-06 23:33:55 +01:00

27 lines
496 B
Python

f = open("Ressources/InputDay4.txt", 'r')
input = ""
for line in f:
if not line.isspace():
input += line
else:
input += 'ü'
input = input.replace("\n", "")
passports = input.split('ü')
requiered = ["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]
valid = 0
for passport in passports:
matches = 0
for requierdInfo in requiered:
if requierdInfo in passport:
matches += 1
if matches == len(requiered):
valid += 1
print(valid)