aoc-2021/01_day/code.py

15 lines
266 B
Python
Raw Permalink Normal View History

2021-12-05 15:52:20 +00:00
import fileinput
previous = None
count = 0
for i,line in enumerate(fileinput.input()):
try:
val = int(line.strip())
except ValueError:
continue
if previous != None and val > previous:
count += 1
previous = val
print(count)