From 9815821fb75020ad1d73fc21f60c18528405c2cf Mon Sep 17 00:00:00 2001 From: Arthur Date: Sun, 10 Dec 2023 15:53:22 +0100 Subject: [PATCH] d09 part one - simpl --- d09/run1.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/d09/run1.py b/d09/run1.py index 9f7195f..8eec455 100644 --- a/d09/run1.py +++ b/d09/run1.py @@ -4,17 +4,14 @@ L = sys.stdin.read().splitlines() S = 0 for report in L: l = [int(r) for r in report.split(' ')] - m = list(l) - latest=[] - latest.append(m[-1]) + S+=l[-1] while not all(v == 0 for v in l): m = [] for i in range(0,len(l)-1): m.append(l[i+1] - l[i]) - latest.append(m[-1]) + S+=m[-1] l = list(m) - S+=sum(latest) print(S) \ No newline at end of file