some cleanups

This commit is contained in:
Heiko Ludwig 2024-12-02 11:06:00 +01:00
parent 89d34ce450
commit d8bd434c0f

View file

@ -18,19 +18,15 @@ def get_report_entries(lines: list) -> list:
def is_safe_single(reports: list) -> bool:
increasing = True
decreasing = True
safe = True
for i in range(len(reports) - 1):
distance = abs(reports[i] - reports[i + 1])
if distance < 1 or distance > 3:
return False
if reports[i] >= reports[i + 1]:
increasing = False
if reports[i] <= reports[i + 1]:
decreasing = False
distance = abs(reports[i] - reports[i + 1])
if distance < 1 or distance > 3:
safe = False
pass
if safe and (increasing or decreasing):
return True
return False
return increasing or decreasing
def is_safe_full(reports: list, dampener: bool) -> bool: