diff options
| author | Luca Ferrari <fluca1978@gmail.com> | 2024-01-22 08:54:32 +0100 |
|---|---|---|
| committer | Luca Ferrari <fluca1978@gmail.com> | 2024-01-22 13:21:10 +0100 |
| commit | 52e2018af75d08a9b77b8e3bb56a7b2fffc6f42b (patch) | |
| tree | 63b205906393dabcfbf3422ee6dc8ae48a3a61e7 /challenge-253/luca-ferrari/python/ch-1.python | |
| parent | 9d7dc816f7775abfee7d90f0a2a969611902be54 (diff) | |
| download | perlweeklychallenge-club-52e2018af75d08a9b77b8e3bb56a7b2fffc6f42b.tar.gz perlweeklychallenge-club-52e2018af75d08a9b77b8e3bb56a7b2fffc6f42b.tar.bz2 perlweeklychallenge-club-52e2018af75d08a9b77b8e3bb56a7b2fffc6f42b.zip | |
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
Diffstat (limited to 'challenge-253/luca-ferrari/python/ch-1.python')
| -rw-r--r-- | challenge-253/luca-ferrari/python/ch-1.python | 28 |
1 files changed, 28 insertions, 0 deletions
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 <https://perlweeklychallenge.org/blog/perl-weekly-challenge-253> +# + +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: ] ) ) |
