-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
37 lines (31 loc) · 861 Bytes
/
main.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
class InvalidPassword(Exception):
pass
def check(password):
characters = list(password)
nnum = 0
try:
if len(characters) >= 7:
pass
else:
raise InvalidPassword('Invalid Password')
for item in characters:
try:
int(item)
nnum += 1
except:
continue
if nnum >= 2:
pass
else:
raise InvalidPassword('Invalid Password')
special = 0
for item in characters:
if item in ['!', '@', '#', '$', '%', '&', '*']:
special += 1
if special >= 2:
return 'Strong'
else:
raise InvalidPassword('Invalid Password')
except:
return 'Weak'
print(check(input()))