Improve input parsing
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user