Solve day 1

This commit is contained in:
Nettika
2023-12-08 20:37:46 -08:00
parent 95c294aa61
commit cfa52e1594
4 changed files with 1123 additions and 0 deletions

37
01/puzzle_test.py Normal file
View File

@@ -0,0 +1,37 @@
from puzzle import (
pt_1_first_digit_pattern,
pt_1_last_digit_pattern,
solve_pt_1,
solve_pt_2,
)
def test_solve_pt_1():
assert (
solve_pt_1(
[
"1abc2",
"pqr3stu8vwx",
"a1b2c3d4e5f",
"treb7uchet",
]
)
== 142
)
def test_solve_pt_2():
assert (
solve_pt_2(
[
"two1nine",
"eightwothree",
"abcone2threexyz",
"xtwone3four",
"4nineeightseven2",
"zoneight234",
"7pqrstsixteen",
]
)
== 281
)