题解 | #密码强度等级#
密码强度等级
https://www.nowcoder.com/practice/52d382c2a7164767bca2064c1c9d5361
st=input()
le=len(st)
ans=0
if le<=4:
ans+=5
elif 5<=le<=7:
ans+=10
else:
ans+=25
a,b=0,0
for i in st:
if ord('a')<=ord(i)<=ord('z'):
a=1
if ord('A')<=ord(i)<=ord('Z'):
b=1
if a+b==2:
ans+=20
elif a+b==1:
ans+=10
cou=0
for i in st:
if ord('0')<=ord(i)<=ord('9'):
cou+=1
if cou==1:
ans+=10
if cou>1:
ans+=20
c=0
for i in st:
if 0x21<=ord(i)<=0x2F or 0x3A<=ord(i)<=0x40 or 0x5B<=ord(i)<=0x60 or 0x7B<=ord(i)<=0x7E:
c+=1
if c==1:
ans+=10
if c>1:
ans+=25
if a+b==2 and cou>0 and c>0:
ans+=5
elif a+b==1 and cou>0 and c>0:
ans+=3
elif a+b==1 and cou>0:
ans+=2
if ans>=90:
print("VERY_SECURE")
elif ans>=80:
print("SECURE")
elif ans>=70:
print("VERY_STRONG")
elif ans>=60:
print("STRONG")
elif ans>=50:
print("AVERAGE")
elif ans>=25:
print("WEAK")
else:
print("VERY_WEAK")
叮咚买菜公司氛围 118人发布
查看15道真题和解析