From 396d7ae9cd0b67483293553b2e0a966a98356c4a Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 5 Dec 2021 11:21:02 +0100 Subject: Add day 4 solutions --- 2017/04/puzzles.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 2017/04/puzzles.py (limited to '2017/04/puzzles.py') 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() -- cgit v1.2.3