]> git.friedersdorff.com Git - max/advent_of_code_2021.git/blobdiff - 8_1.py
Do day 8
[max/advent_of_code_2021.git] / 8_1.py
diff --git a/8_1.py b/8_1.py
new file mode 100644 (file)
index 0000000..b6e606d
--- /dev/null
+++ b/8_1.py
@@ -0,0 +1,11 @@
+"""Decode stupid 7 segment displays"""
+
+count = 0
+with open("8_input.txt") as f:
+    for line in f:
+        digits = line.split("|")[1].strip().split(" ")
+        for digit in digits:
+            if len(digit) in [2, 3, 4, 7]:  # Corresponds to 1, 7, 4, 8
+                count += 1
+
+print(count)