aboutsummaryrefslogtreecommitdiff
path: root/challenge-256/luca-ferrari/python/ch-1.python
diff options
context:
space:
mode:
authorLuca Ferrari <fluca1978@gmail.com>2024-02-14 11:29:06 +0100
committerLuca Ferrari <fluca1978@gmail.com>2024-02-15 10:06:02 +0100
commit0cc3d19f45790123a25f7f33d9c5b3b239a48c5f (patch)
tree4c22fe1a6bbbb5d69332825c93c922bfa4ff1c2f /challenge-256/luca-ferrari/python/ch-1.python
parent0eea0ad3c68531bab8e840b94d3ab2dfb02f1683 (diff)
downloadperlweeklychallenge-club-0cc3d19f45790123a25f7f33d9c5b3b239a48c5f.tar.gz
perlweeklychallenge-club-0cc3d19f45790123a25f7f33d9c5b3b239a48c5f.tar.bz2
perlweeklychallenge-club-0cc3d19f45790123a25f7f33d9c5b3b239a48c5f.zip
PWC 256
Task 1 Raku done Task 2 Raku done Task 1 PL/Perl done Task 2 PL/Perl done Task 1 PL/PgSQL done Task 2 PL/PgSQL done Task 1 Python done Task 2 Python done Task 1 PL/Java done Task 2 PL/Java done
Diffstat (limited to 'challenge-256/luca-ferrari/python/ch-1.python')
-rw-r--r--challenge-256/luca-ferrari/python/ch-1.python26
1 files changed, 26 insertions, 0 deletions
diff --git a/challenge-256/luca-ferrari/python/ch-1.python b/challenge-256/luca-ferrari/python/ch-1.python
new file mode 100644
index 0000000000..e8456319db
--- /dev/null
+++ b/challenge-256/luca-ferrari/python/ch-1.python
@@ -0,0 +1,26 @@
+#!python
+
+#
+# Perl Weekly Challenge 256
+# Task 1
+#
+# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-256>
+#
+
+import sys
+
+# task implementation
+# the return value will be printed
+def task_1( args ):
+ max = 0
+ for w in args:
+ count = len( list( filter( lambda rw: rw == ''.join( reversed( w ) ), args ) ) )
+ if count > max:
+ max = count
+
+ return max
+
+
+# invoke the main without the command itself
+if __name__ == '__main__':
+ print( task_1( sys.argv[ 1: ] ) )