diff options
| author | Luca Ferrari <fluca1978@gmail.com> | 2024-09-20 09:38:38 +0200 |
|---|---|---|
| committer | Luca Ferrari <fluca1978@gmail.com> | 2024-09-20 10:35:16 +0200 |
| commit | ab26905beb70d890b8e43bbb1ae0e06a00a22491 (patch) | |
| tree | c4682508186624981b363c505ea36d9b2092289d /challenge-287/luca-ferrari/python/ch-1.py | |
| parent | 46687ac6d2c5d604e72f4aaae1473c452cb45128 (diff) | |
| download | perlweeklychallenge-club-ab26905beb70d890b8e43bbb1ae0e06a00a22491.tar.gz perlweeklychallenge-club-ab26905beb70d890b8e43bbb1ae0e06a00a22491.tar.bz2 perlweeklychallenge-club-ab26905beb70d890b8e43bbb1ae0e06a00a22491.zip | |
PWC 287
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 PL/Java done
Task 2 PL/Java done
Task 1 Python done
Task 2 Python done
Diffstat (limited to 'challenge-287/luca-ferrari/python/ch-1.py')
| -rw-r--r-- | challenge-287/luca-ferrari/python/ch-1.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-287/luca-ferrari/python/ch-1.py b/challenge-287/luca-ferrari/python/ch-1.py new file mode 100644 index 0000000000..2fbe66f7b9 --- /dev/null +++ b/challenge-287/luca-ferrari/python/ch-1.py @@ -0,0 +1,25 @@ +#!python + +# +# Perl Weekly Challenge 287 +# Task 1 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-287> +# + +import sys +import re + +# task implementation +# the return value will be printed +def task_1( args ): + password = args[ 0 ] + lc = re.compile( '[a-z]' ) + uc = re.compile( '[A-Z]' ) + dg = re.compile( '[0-9]' ) + wrong = re.compile( '(.)\\1\\1' ) + return lc.search( password ) and uc.search( password ) and dg.search( password ) and wrong.search( password ) is None + +# invoke the main without the command itself +if __name__ == '__main__': + print( task_1( sys.argv[ 1: ] ) ) |
