From 1a062eb09991b572768eb29b844d5120154a65f1 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 14 Dec 2020 08:16:28 +0100 Subject: [PATCH] Cleanup --- 2020/14.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/2020/14.py b/2020/14.py index 9476504..85bad78 100755 --- a/2020/14.py +++ b/2020/14.py @@ -92,9 +92,7 @@ curMask = None mem = dict() mem2 = dict() -for i in range( len(data) ): - line = data[i] - +for line in data: address, val = parseLine(line) if( address != "mask" ): val, oldval = applyMask(val, curMask) @@ -114,12 +112,7 @@ for i in range( len(data) ): curMask = val continue -memsum, memsum2 = 0, 0 -for addr, val in mem.items(): - memsum += val - -for addr, val in mem2.items(): - memsum2 += val +memsum, memsum2 = sum(mem.values()), sum(mem2.values()) print("Part1:", memsum) print("Part2:", memsum2)