From 107af855b4484091594e35c1072b2e0344f0067f Mon Sep 17 00:00:00 2001 From: Heiko Ludwig Date: Mon, 2 Dec 2024 11:13:59 +0100 Subject: [PATCH] more cleanups --- day_02/program.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/day_02/program.py b/day_02/program.py index c726644..a85eb07 100755 --- a/day_02/program.py +++ b/day_02/program.py @@ -20,11 +20,11 @@ def is_safe_single(reports: list) -> bool: decreasing = True for i in range(len(reports) - 1): distance = abs(reports[i] - reports[i + 1]) - if distance < 1 or distance > 3: + if distance == 0 or distance > 3: return False - if reports[i] >= reports[i + 1]: + if reports[i] > reports[i + 1]: increasing = False - if reports[i] <= reports[i + 1]: + if reports[i] < reports[i + 1]: decreasing = False return increasing or decreasing