Set up and day 1 start

This commit is contained in:
Maarten van Sluijs 2023-12-01 12:30:52 +01:00
commit ae87263249
3 changed files with 1024 additions and 0 deletions

1000
Data/day1.txt Normal file

File diff suppressed because it is too large Load Diff

19
Questions/Day 1.py Normal file
View File

@ -0,0 +1,19 @@
from utils import load_data
def question_1():
filepath = "Data/Day1.txt"
data = load_data(filepath)
sum = 0
for line in data:
line = "".join(filter(str.isdigit, line))
sum += int(line[0]+line[-1])
print(f"Answer to question 1 is: {sum}")
def question_2():
print(f"Answer to question 2 is: {}")
if __name__ == "__main__":
# question_1()
question_2()

5
Questions/utils.py Normal file
View File

@ -0,0 +1,5 @@
def load_data(filepath) -> list:
text_file = open(filepath, "r")
data = text_file.read().splitlines()
text_file.close()
return data