mirror of
https://github.com/sstent/Advent2021.git
synced 2026-01-26 17:12:14 +00:00
42 lines
777 B
Python
42 lines
777 B
Python
from aocd import get_data
|
|
from aocd import submit
|
|
input_data = get_data(day=1, year=2021)
|
|
|
|
|
|
|
|
test_data = """199
|
|
200
|
|
208
|
|
210
|
|
200
|
|
207
|
|
240
|
|
269
|
|
260
|
|
263"""
|
|
|
|
lines = input_data.split("\n")
|
|
# lines = test_data.split("\n")
|
|
|
|
|
|
count = 0
|
|
window_list = []
|
|
for index, value in enumerate(lines):
|
|
if index <= len(lines) - 3:
|
|
window = int(lines[index]) + int(lines[index + 1]) + int(lines[index + 2])
|
|
window_list.append(window)
|
|
|
|
|
|
for index, value in enumerate(window_list):
|
|
if index != 0:
|
|
if int(value) > int(window_list[index - 1]):
|
|
print(str(index)+ ": " + str(value) + " + "+ str(window_list[index - 1]))
|
|
# print("1")
|
|
count += 1
|
|
|
|
print("Input length:" + str(len(lines)))
|
|
print(count)
|
|
print(window_list)
|
|
|
|
submit(count)
|