diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-01-22 18:19:47 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-22 18:19:47 +0000 |
| commit | 64774d41bd8c23d9c281dcd27228aaa53967a822 (patch) | |
| tree | 29d250990e5d207389956486e34870881034e1b9 /challenge-253/luca-ferrari/python/ch-1.python | |
| parent | 1126463e11f729ed009174cca95f65443b3ec575 (diff) | |
| parent | 52e2018af75d08a9b77b8e3bb56a7b2fffc6f42b (diff) | |
| download | perlweeklychallenge-club-64774d41bd8c23d9c281dcd27228aaa53967a822.tar.gz perlweeklychallenge-club-64774d41bd8c23d9c281dcd27228aaa53967a822.tar.bz2 perlweeklychallenge-club-64774d41bd8c23d9c281dcd27228aaa53967a822.zip | |
Merge pull request #9444 from fluca1978/PWC253
PWC 253
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: ] ) ) |
