From eb59781112957bf1f18fead8a12386050ff66cad Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 29 Dec 2021 18:40:43 -0700 Subject: [PATCH] Add code part 1 in Python --- day_01/python/part_1.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 day_01/python/part_1.py diff --git a/day_01/python/part_1.py b/day_01/python/part_1.py new file mode 100644 index 0000000..0138e8e --- /dev/null +++ b/day_01/python/part_1.py @@ -0,0 +1,13 @@ +increasing = 0 + + +with open("../input", "r") as file: + data = file.read().split("\n") + + for i in range(1, len(data)): + delta = int(data[i - 1]) - int(data[i]) + + if delta < 0: + increasing += 1 + +print(f"The ocean floor has increased {increasing} times") \ No newline at end of file