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-1.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-1.python')
| -rw-r--r-- | challenge-256/luca-ferrari/python/ch-1.python | 26 |
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: ] ) ) |
