This commit is contained in:
Marcus Ferl 2022-12-19 19:26:41 +01:00
parent 558b05c797
commit 20a2dee1f1
2 changed files with 60 additions and 0 deletions

40
day9.py Normal file
View File

@ -0,0 +1,40 @@
day = "day9"
file = f"inputs/{day}.txt"
def part_one(file):
result = 0
input = open(file, "r")
input = input.readlines()
numbers = []
for i in input:
numbers.append(int(i))
for number in range(0,len(numbers)):
for nextnumber in range(1,len(numbers)):
if numbers[number] + numbers[nextnumber] in numbers:
break;
else:
rvnumber = numbers[number] + numbers[nextnumber]
print(rvnumber)
print(f"Part 1: {result}")
def part_two(file):
result = 0
input = open(file, "r")
input = input.readlines()
print(f"Part 2: {result}")
part_one(file)
part_two(file)

View File

@ -0,0 +1,20 @@
35
20
15
25
47
40
62
55
65
95
102
117
150
182
127
219
299
277
309
576