diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2024-01-29 04:49:37 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2024-01-29 04:49:37 +0000 |
| commit | 45892f35c3d5306dc9498cc404169a21486a2bf9 (patch) | |
| tree | 1a3ba13b56bc757428e4baaedda476d86d515bdb /challenge-253/luca-ferrari/python/ch-1.py | |
| parent | c13d4891bfaede87ed0689441bf47e15fe1e880e (diff) | |
| download | perlweeklychallenge-club-45892f35c3d5306dc9498cc404169a21486a2bf9.tar.gz perlweeklychallenge-club-45892f35c3d5306dc9498cc404169a21486a2bf9.tar.bz2 perlweeklychallenge-club-45892f35c3d5306dc9498cc404169a21486a2bf9.zip | |
- Added template for week 254.
Diffstat (limited to 'challenge-253/luca-ferrari/python/ch-1.py')
| -rw-r--r-- | challenge-253/luca-ferrari/python/ch-1.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/challenge-253/luca-ferrari/python/ch-1.py b/challenge-253/luca-ferrari/python/ch-1.py new file mode 100644 index 0000000000..07a97f09cd --- /dev/null +++ b/challenge-253/luca-ferrari/python/ch-1.py @@ -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: ] ) ) |
