diff options
author | Thomas Voss <thomasvoss@live.com> | 2021-12-08 10:47:52 +0100 |
---|---|---|
committer | Thomas Voss <thomasvoss@live.com> | 2021-12-08 10:47:52 +0100 |
commit | 01274303075bb131aafb1977ae69a4c871f9e9c4 (patch) | |
tree | 8093d970712ba855321b3881a7dceac7c065d4da /2021/08/puzzle-1.py | |
parent | e7e3c391a13c96b1b0553078b784167eab06999e (diff) |
More golfing
Diffstat (limited to '2021/08/puzzle-1.py')
-rwxr-xr-x | 2021/08/puzzle-1.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/2021/08/puzzle-1.py b/2021/08/puzzle-1.py index e1ffa7d..9579237 100755 --- a/2021/08/puzzle-1.py +++ b/2021/08/puzzle-1.py @@ -3,9 +3,14 @@ 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)) + print( + sum( + map( + lambda l: sum(map(lambda s: len(s) in (2, 3, 4, 7), l)), + map(lambda l: l.split("|")[1].strip().split(), f.readlines()), + ) + ) + ) if __name__ == "__main__": |