From 68f9929d37899a229ef9a247770e4032899e6639 Mon Sep 17 00:00:00 2001 From: Yitzchak Scott-Thoennes Date: Mon, 19 May 2025 18:00:02 -0400 Subject: challenge 322 perlish python solutions by ysth --- challenge-322/ysth/python/ch-1.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 challenge-322/ysth/python/ch-1.py (limited to 'challenge-322/ysth/python/ch-1.py') diff --git a/challenge-322/ysth/python/ch-1.py b/challenge-322/ysth/python/ch-1.py new file mode 100644 index 0000000000..739058f480 --- /dev/null +++ b/challenge-322/ysth/python/ch-1.py @@ -0,0 +1,18 @@ +import itertools +import sys + +string = sys.argv[1] +group_size = int(sys.argv[2]) + +print( + "-".join( + reversed( + [ + "".join(reversed(group)) + for group in itertools.batched( + reversed(string.replace("-", "")), group_size + ) + ] + ) + ) +) -- cgit