aboutsummaryrefslogtreecommitdiff
path: root/challenge-287/luca-ferrari/python/ch-1.py
blob: 2fbe66f7b9c9b103625ae3c9a4759fc6ba7976a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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: ] ) )