start d9
This commit is contained in:
parent
558b05c797
commit
20a2dee1f1
40
day9.py
Normal file
40
day9.py
Normal 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)
|
|
@ -0,0 +1,20 @@
|
|||
35
|
||||
20
|
||||
15
|
||||
25
|
||||
47
|
||||
40
|
||||
62
|
||||
55
|
||||
65
|
||||
95
|
||||
102
|
||||
117
|
||||
150
|
||||
182
|
||||
127
|
||||
219
|
||||
299
|
||||
277
|
||||
309
|
||||
576
|
Loading…
Reference in New Issue
Block a user