Wel goed zo, joe
This commit is contained in:
22
day9/day9.py
22
day9/day9.py
@@ -11,12 +11,11 @@ def part1():
|
||||
file = open("input.txt")
|
||||
|
||||
preamble_length = 25
|
||||
lines = file.readlines()
|
||||
|
||||
lines = [int(i) for i in file.readlines()]
|
||||
queue = []
|
||||
|
||||
for i in range(0, preamble_length):
|
||||
number = int(lines[i])
|
||||
number = lines[i]
|
||||
queue.append(number)
|
||||
|
||||
for i in range(preamble_length, len(lines)):
|
||||
@@ -30,16 +29,23 @@ def part1():
|
||||
|
||||
print("Part 1: %d" % number)
|
||||
|
||||
return number, lines
|
||||
|
||||
|
||||
def part2():
|
||||
file = open("input.txt")
|
||||
number, lines = part1()
|
||||
|
||||
for line in file:
|
||||
pass
|
||||
for size in range(2, len(lines)):
|
||||
for finger in range(0, len(lines) - size):
|
||||
subset = lines[finger:(finger + size)]
|
||||
subset = [int(i) for i in subset]
|
||||
|
||||
print("Part 2: %d")
|
||||
if sum(subset) == number:
|
||||
ans = min(subset) + max(subset)
|
||||
print("Part 2: %d" % ans)
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
part1()
|
||||
# part1()
|
||||
part2()
|
||||
|
||||
Reference in New Issue
Block a user