Finish day 4 part 2
This commit is contained in:
parent
d156f31e94
commit
cc0c353ce1
2 changed files with 1036 additions and 0 deletions
1023
2020/day 4/P2/input.txt
Normal file
1023
2020/day 4/P2/input.txt
Normal file
File diff suppressed because it is too large
Load diff
13
2020/day 4/P2/passport_processing.py
Normal file
13
2020/day 4/P2/passport_processing.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
print(
|
||||||
|
len(
|
||||||
|
list(
|
||||||
|
filter(
|
||||||
|
lambda x: x and len(x) == 7,
|
||||||
|
map(
|
||||||
|
lambda x: __import__("re").findall(r"(?:(?:byr:(?:19[2-9][0-9]|200[0-2])|iyr:(?:201[0-9]|2020)|eyr:(?:202[0-9]|2030)|hgt:(?:1[5-8][0-9]cm|19[0-3]cm|59in|6[0-9]in|7[0-6]in)|hcl:#[0-9a-f]{6}|ecl:(?:amb|blu|brn|gry|grn|hzl|oth)|pid:[0-9]{9})(?: |$))", x),
|
||||||
|
[m.replace("\n", " ") for m in open("input.txt").read().split("\n\n")]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
Loading…
Reference in a new issue