Set up and day 1 start
This commit is contained in:
commit
ae87263249
File diff suppressed because it is too large
Load Diff
|
@ -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()
|
|
@ -0,0 +1,5 @@
|
|||
def load_data(filepath) -> list:
|
||||
text_file = open(filepath, "r")
|
||||
data = text_file.read().splitlines()
|
||||
text_file.close()
|
||||
return data
|
Loading…
Reference in New Issue