diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-02-15 19:07:15 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-15 19:07:15 +0000 |
| commit | d94684a52764452af4edbb2a33b7d409306e271c (patch) | |
| tree | 0e4a7052c4c740d03ef90644e220981492e502cf /challenge-256/luca-ferrari/python/ch-2.python | |
| parent | e515224a439c9525a7e7cb7d33fc4b4c9af9785e (diff) | |
| parent | 0cc3d19f45790123a25f7f33d9c5b3b239a48c5f (diff) | |
| download | perlweeklychallenge-club-d94684a52764452af4edbb2a33b7d409306e271c.tar.gz perlweeklychallenge-club-d94684a52764452af4edbb2a33b7d409306e271c.tar.bz2 perlweeklychallenge-club-d94684a52764452af4edbb2a33b7d409306e271c.zip | |
Merge pull request #9587 from fluca1978/PWC256
PWC 256
Diffstat (limited to 'challenge-256/luca-ferrari/python/ch-2.python')
| -rw-r--r-- | challenge-256/luca-ferrari/python/ch-2.python | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/challenge-256/luca-ferrari/python/ch-2.python b/challenge-256/luca-ferrari/python/ch-2.python new file mode 100644 index 0000000000..abf9af51de --- /dev/null +++ b/challenge-256/luca-ferrari/python/ch-2.python @@ -0,0 +1,32 @@ +#!python + +# +# Perl Weekly Challenge 256 +# Task 2 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-256> +# + +import sys + +# task implementation +# the return value will be printed +def task_2( args ): + left = args[ 0 ] + right = args[ 1 ] + output = '' + + max_index = max( len( left ), len( right ) ) + + for i in range( 0, max_index ): + if i < len( left ): + output += left[ i ] + if i < len( right ): + output += right[ i ] + + return output + + +# invoke the main without the command itself +if __name__ == '__main__': + print( task_2( sys.argv[ 1: ] ) ) |
