From 52e2018af75d08a9b77b8e3bb56a7b2fffc6f42b Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 22 Jan 2024 08:54:32 +0100 Subject: PWC 253 Task 1 Raku done Task 2 Raku done Task 1 PL/Perl done Task 2 PL/Perl done Task 1 PL/PgSQL done Task 2 PL/PgSQL done Task 1 Python done Task 2 Python done Task 1 PL/Java done Task 2 PL/Java done --- challenge-253/luca-ferrari/python/ch-1.python | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 challenge-253/luca-ferrari/python/ch-1.python (limited to 'challenge-253/luca-ferrari/python/ch-1.python') diff --git a/challenge-253/luca-ferrari/python/ch-1.python b/challenge-253/luca-ferrari/python/ch-1.python new file mode 100644 index 0000000000..07a97f09cd --- /dev/null +++ b/challenge-253/luca-ferrari/python/ch-1.python @@ -0,0 +1,28 @@ +#!python + +# +# Perl Weekly Challenge 253 +# Task 1 +# +# See +# + +import sys +import re + +# task implementation +# the return value will be printed +def task_1( args ): + separator = args[ 0 ]; + split_words = [] + for i in range( 1, len( args ) ): + current_words = args[ i ] + for w in re.split( "[%s]" % separator, current_words ): + split_words.append( w ) + + return ','.join( split_words ) + + +# invoke the main without the command itself +if __name__ == '__main__': + print( task_1( sys.argv[ 1: ] ) ) -- cgit