From cc86bc72ff7c1625dd9e05027f6c7a740604237b Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 8 Dec 2021 07:02:51 +0100 Subject: Add day 8 solutions --- 2021/08/puzzle-1.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 2021/08/puzzle-1.py (limited to '2021/08/puzzle-1.py') diff --git a/2021/08/puzzle-1.py b/2021/08/puzzle-1.py new file mode 100755 index 0000000..e1ffa7d --- /dev/null +++ b/2021/08/puzzle-1.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + + +def main() -> None: + with open("input", "r", encoding="utf-8") as f: + data = list(map(lambda l: l.split("|")[1].strip().split(), f.readlines())) + + print(sum(sum(len(s) in (2, 3, 4, 7) for s in line) for line in data)) + + +if __name__ == "__main__": + main() -- cgit v1.2.3