diff options
author | Thomas Voss <thomasvoss@live.com> | 2021-12-05 11:21:02 +0100 |
---|---|---|
committer | Thomas Voss <thomasvoss@live.com> | 2021-12-05 11:21:02 +0100 |
commit | 396d7ae9cd0b67483293553b2e0a966a98356c4a (patch) | |
tree | f67b7827d1a2d4af2e1e8551e16464e7322adfab /2017/04/puzzles.py | |
parent | 2e28981207430301b54d4d74ee620d0f159f4d8b (diff) |
Add day 4 solutions
Diffstat (limited to '2017/04/puzzles.py')
-rw-r--r-- | 2017/04/puzzles.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/2017/04/puzzles.py b/2017/04/puzzles.py new file mode 100644 index 0000000..1cf6924 --- /dev/null +++ b/2017/04/puzzles.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + + +def main() -> None: + with open("input", "r", encoding="utf-8") as f: + print( + sum( + map( + lambda p: len(p) == len(set(p)), + # START PART 1 + map ( + lambda l: l.split(), f.readlines() + ), + # END PART 1 START PART 2 + map( + lambda l: list(map(lambda w: "".join(sorted(w)), l.split())), f.readlines() + ), + # END PART 2 + ) + ) + ) + + +if __name__ == "__main__": + main() |