aboutsummaryrefslogtreecommitdiff
path: root/challenge-269/luca-ferrari/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-269/luca-ferrari/python/ch-1.py')
-rw-r--r--challenge-269/luca-ferrari/python/ch-1.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/challenge-269/luca-ferrari/python/ch-1.py b/challenge-269/luca-ferrari/python/ch-1.py
new file mode 100644
index 0000000000..b00b23f6d0
--- /dev/null
+++ b/challenge-269/luca-ferrari/python/ch-1.py
@@ -0,0 +1,29 @@
+#!python
+
+#
+# Perl Weekly Challenge 269
+# Task 1
+#
+# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-269>
+#
+
+import sys
+
+# task implementation
+# the return value will be printed
+def task_1( args ):
+ nums = list( map( int, args ) )
+ couples = []
+
+ for i in range( 0, len( nums ) ):
+ for j in range ( i + 1, len( nums ) ):
+ if ( nums[ i ] | nums[ j ] ) % 2 == 0 :
+ couples.append( nums[ i ] )
+ couples.append( nums[ j ] )
+
+ return couples
+
+
+# invoke the main without the command itself
+if __name__ == '__main__':
+ print( task_1( sys.argv[ 1: ] ) )