From 5df4492ab1fdedff494e953fea91a937ecb29a84 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sat, 11 Dec 2021 12:41:05 -0500 Subject: [PATCH] day8: Remove debug prints, compute sum in-script I was so tired at the point of doing these... I just piped it to my "csum" program for pt b :) --- 8/a.py | 1 - 8/b.py | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/8/a.py b/8/a.py index 262b46a..4d87c18 100755 --- a/8/a.py +++ b/8/a.py @@ -10,7 +10,6 @@ for l in sys.stdin: elif not seen: continue if len(sig) == 2 or len(sig) == 7 or len(sig) == 4 or len(sig) == 3: - print(sig, count) count += 1 print(count) diff --git a/8/b.py b/8/b.py index 30b16ab..7a58648 100755 --- a/8/b.py +++ b/8/b.py @@ -5,6 +5,7 @@ import sys # Map abcdefg -> 1234567 (orig positions) def mapit(preface): M = {} + def mset(sig, val): if val in M: print(val) @@ -67,6 +68,7 @@ def contains(sig, M, query): return False return True + def contained(sig, M, query): if query not in M: return False @@ -76,6 +78,8 @@ def contained(sig, M, query): return False return True + +total = 0 for l in sys.stdin: # Sort into two buckets per line seen = False @@ -99,4 +103,6 @@ for l in sys.stdin: for m, v in M.items(): if s == v: out += m - print(out) + total += int(out) + +print(total) -- libgit2 1.8.1