]> git.friedersdorff.com Git - max/advent_of_code_2021.git/blob - 1_1.py
Try day 14
[max/advent_of_code_2021.git] / 1_1.py
1 """Advent day 1, challenge 1
2
3 Count the number of times the input number
4 is higher than the previous one
5 """
6
7 first = False
8 prev_depth = None
9 n_increased = 0
10 with open("1_1_input.txt") as f:
11     for line in f:
12         depth = int(line)
13         if (prev_depth is not None
14                 and depth > prev_depth):
15             n_increased += 1
16
17         prev_depth = depth
18
19 print(n_increased)