X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=1_1.py;h=3b41b1d6e40358e215fdd4440a923c541784762b;hb=refs%2Fheads%2Fmaster;hp=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391;hpb=f907075b95f329d14ef9d38fb98cdd926a39075a;p=max%2Fadvent_of_code_2021.git diff --git a/1_1.py b/1_1.py index e69de29..3b41b1d 100644 --- a/1_1.py +++ b/1_1.py @@ -0,0 +1,19 @@ +"""Advent day 1, challenge 1 + +Count the number of times the input number +is higher than the previous one +""" + +first = False +prev_depth = None +n_increased = 0 +with open("1_1_input.txt") as f: + for line in f: + depth = int(line) + if (prev_depth is not None + and depth > prev_depth): + n_increased += 1 + + prev_depth = depth + +print(n_increased)