题解 | #密码强度等级#

密码强度等级

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")

全部评论

相关推荐

09-14 17:23
门头沟学院
故事和酒66:所以说副业很重要,程序员干到40岁,再怎么也赚300万了,吃吃利息也够活下去
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务