题解 | #密码强度等级#
密码强度等级
https://www.nowcoder.com/practice/52d382c2a7164767bca2064c1c9d5361
s = input()
zimu = []
nums = []
fuhao = []
count = 0
for i in s:
if i.isalpha():
zimu.append(i)
elif i.isdigit():
nums.append(i)
else:
fuhao.append(i)
if len(s)<=4:
count += 5
elif 5<=len(s)<=7:
count += 10
else:
count += 25
daxiao = 0
for i in zimu:
if i.isupper():
count += 10
daxiao += 1
break
for i in zimu:
if i.islower():
count += 10
daxiao += 1
break
if len(nums)==1:
count += 10
elif len(nums)>1:
count += 20
if len(fuhao)==1:
count += 10
elif len(fuhao)>1:
count += 25
if daxiao==2 and len(nums)>=1 and len(fuhao)>=1:
count += 5
elif daxiao==1 and len(nums)>=1 and len(fuhao)>=1:
count += 3
elif daxiao>=1 and len(nums)>=1 and len(fuhao)==0:
count += 2
if count>=90:
print('VERY_SECURE')
elif count>=80:
print('SECURE')
elif count>=70:
print('VERY_STRONG')
elif count>=60:
print('STRONG')
elif count>=50:
print('AVERAGE')
elif count>=25:
print('WEAK')
else:
print('VERY_WEAK')