-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path2253.py
45 lines (37 loc) · 1.11 KB
/
2253.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# https://www.urionlinejudge.com.br/judge/en/problems/view/2253
import re
def password_validator(password):
while True:
if len(password) < 6 or len(password) > 32:
break
elif not re.search('[a-z]', password):
break
elif not re.search('[A-Z]', password):
break
elif not re.search('[0-9]', password):
break
elif not password.isalnum():
break
else:
return True
return False
def tests():
assert not password_validator('URI Online Judge')
assert password_validator('AbcdEfgh99')
assert password_validator('URIOnlineJudge12')
assert not password_validator('URI Online Judge 12')
assert not password_validator('Aass9')
assert password_validator('Aassd9')
def uri_format():
while True:
try:
password = input()
if password_validator(password):
print('Senha valida.')
else:
print('Senha invalida.')
except EOFError:
break
if __name__ == '__main__':
tests()
uri_format()