mirror of
https://github.com/sstent/Advent2021.git
synced 2026-01-28 18:11:37 +00:00
first
This commit is contained in:
38
Day1_1/main.py
Normal file
38
Day1_1/main.py
Normal file
@@ -0,0 +1,38 @@
|
||||
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")
|
||||
|
||||
|
||||
|
||||
count = 0
|
||||
down_count = 0
|
||||
for index, value in enumerate(lines):
|
||||
# if index != 0:
|
||||
if int(value) > int(lines[index - 1]):
|
||||
print(str(index)+ ": " + str(value) + " + "+ str(lines[index - 1]))
|
||||
# print("1")
|
||||
count += 1
|
||||
else:
|
||||
print(str(index)+ ": " + str(value) + " < "+ str(lines[index - 1]))
|
||||
# print("0")
|
||||
down_count += 1
|
||||
|
||||
print("Input length:" + str(len(lines)))
|
||||
print(count)
|
||||
print(down_count)
|
||||
#submit(count)
|
||||
Reference in New Issue
Block a user