aboutsummaryrefslogtreecommitdiff
path: root/challenge-256/luca-ferrari/python/ch-2.python
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-256/luca-ferrari/python/ch-2.python')
-rw-r--r--challenge-256/luca-ferrari/python/ch-2.python32
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: ] ) )