Improve input parsing

This commit is contained in:
2024-12-08 08:26:25 -08:00
parent b9f544ed1e
commit 569714d227
8 changed files with 19 additions and 18 deletions

View File

@@ -7,7 +7,7 @@ test_input = """
1 3
3 9
3 3
""".strip()
"""
test_solution_p1 = 11
test_solution_p2 = 31
@@ -28,6 +28,6 @@ def solve_p2(puzzle_input: str) -> int:
def _parse_lists(puzzle_input: str) -> tuple[list[int], list[int]]:
lines = (line.partition(" ") for line in puzzle_input.split("\n") if line)
lines = (line.partition(" ") for line in puzzle_input.strip().split("\n"))
list1, list2 = zip(*((int(line[0]), int(line[2])) for line in lines))
return list1, list2