From: Maximilian Friedersdorff Date: Sat, 4 Dec 2021 21:31:17 +0000 (+0000) Subject: Finish 1_1 X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=ee024f7c12cc861a63b21d608221849c79f0684b;hp=f907075b95f329d14ef9d38fb98cdd926a39075a;p=max%2Fadvent_of_code_2021.git Finish 1_1 --- 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)