Finish day 4 part 1
This commit is contained in:
parent
795b015ac9
commit
d156f31e94
2 changed files with 1036 additions and 0 deletions
1023
2020/day 4/P1/input.txt
Normal file
1023
2020/day 4/P1/input.txt
Normal file
File diff suppressed because it is too large
Load diff
13
2020/day 4/P1/passport_processing.py
Normal file
13
2020/day 4/P1/passport_processing.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
print(
|
||||||
|
len(
|
||||||
|
list(
|
||||||
|
filter(
|
||||||
|
lambda x: all(y in [e[1] for e in x] for y in ["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]),
|
||||||
|
map(
|
||||||
|
lambda x: __import__("re").findall(r"((byr|iyr|eyr|hgt|hcl|ecl|pid|cid):([a-zA-Z0-9#]+))", x),
|
||||||
|
[m.replace("\n", " ") for m in open("input.txt").read().split("\n\n")]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
Loading…
Reference in a new issue