From ee024f7c12cc861a63b21d608221849c79f0684b Mon Sep 17 00:00:00 2001 From: Maximilian Friedersdorff Date: Sat, 4 Dec 2021 21:31:17 +0000 Subject: [PATCH] Finish 1_1 --- 1_1.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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) -- 2.45.2