day 1 - part 2
This commit is contained in:
parent
b844fafd78
commit
5f492b3f66
6 changed files with 99 additions and 22 deletions
16
2024/day1/common.py
Normal file
16
2024/day1/common.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from pathlib import Path
|
||||
|
||||
|
||||
def get_lists(data_file: Path) -> tuple[list[int], list[int]]:
|
||||
list1 = []
|
||||
list2 = []
|
||||
for line in data_file.open():
|
||||
numbers = line.strip().split(" ")
|
||||
list1.append(int(numbers[0]))
|
||||
list2.append(int(numbers[1]))
|
||||
return list1, list2
|
||||
|
||||
|
||||
def get_ordered_lists(data_file: Path) -> tuple[list[int], list[int]]:
|
||||
list1, list2 = get_lists(data_file)
|
||||
return sorted(list1), sorted(list2)
|
Loading…
Add table
Add a link
Reference in a new issue