From a346958b298bc9fa8a46e9802b8926d719622397 Mon Sep 17 00:00:00 2001 From: Andres Date: Sun, 15 Dec 2024 21:28:40 +0100 Subject: [PATCH] 2015 day 6 refactored a bit --- 2015/day-6/part-1.py | 5 +---- 2015/day-6/part-2.py | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/2015/day-6/part-1.py b/2015/day-6/part-1.py index 33ea6de..6d70ea9 100644 --- a/2015/day-6/part-1.py +++ b/2015/day-6/part-1.py @@ -24,7 +24,4 @@ for line in lines: lights[(i, j)] = False else: lights[(i, j)] = not lights[(i, j)] -count = 0 -for v in lights.values(): - count += v -print(count) +print(sum(lights.values())) diff --git a/2015/day-6/part-2.py b/2015/day-6/part-2.py index 620780d..bdcba44 100644 --- a/2015/day-6/part-2.py +++ b/2015/day-6/part-2.py @@ -27,7 +27,5 @@ for line in lines: lights[(i, j)] -= 1 else: lights[(i, j)] += 2 -count = 0 -for v in lights.values(): - count += v -print(count) + +print(sum(lights.values()))