题解 | #密码强度等级#
密码强度等级
https://www.nowcoder.com/practice/52d382c2a7164767bca2064c1c9d5361
str1=str(input())
score=lowwer=upper=counte=character=award=flagword=flagWord=0
if len(str1)<=4:
score=score+5
elif 4<len(str1)<=7:
score=score+10
elif len(str1)>7:
score=score+25
for i in str1:
if i.isalpha():
if 'a'<=i<='z':
lowwer=lowwer+1
elif 'A'<=i<='Z':
upper=upper+1
elif i.isdigit():
counte=counte+1
else:
character=character+1
if (lowwer==0 and upper!=0) or (lowwer!=0 and upper==0):
score=score+10
flagword=1
elif lowwer!=0 and upper!=0:
score=score+20
flagWord=1
if counte>1:
score=score+20
elif counte==1:
score=score+10
if character>1:
score=score+25
elif character==1:
score=score+10
if flagword==1 and counte!=0 and character==0:
award=2
elif flagword==1 and counte!=0 and character!=0:
award=3
elif flagWord==1 and counte!=0 and character!=0:
award=5
scores=score+award
if scores>=90:
print('VERY_SECURE')
elif scores>=80:
print('SECURE')
elif scores>=70:
print('VERY_STRONG')
elif scores>=60:
print('STRONG')
elif scores>=50:
print('AVERAGE')
elif scores>=25:
print('WEAK')
elif scores>=0:
print('VERY_WEAK')
暴力法,简单易懂