题解 | #密码强度等级#

密码强度等级

https://www.nowcoder.com/practice/52d382c2a7164767bca2064c1c9d5361

from re import findall


fen = 0
mi = input()
if len(mi)<=4:
    fen += 5
elif 5<=len(mi)<=7:
    fen+=10
elif len(mi)>=8:
    fen+= 25

zj = 0
zj = int(bool(findall('[a-z]',mi)))+int(bool(findall('[A-Z]',mi)))
if zj == 1:
    fen+=10
if zj == 2:
    fen+=20
sl = len(findall('[1-9]',mi))
if sl == 1:
    fen += 10
elif sl >1:
    fen += 20
fl = len(findall('[^1-9a-zA-Z]',mi))
if fl == 1:
    fen += 10
elif fl >1:
    fen += 25
if fl:
    if zj==2 and sl:
        fen += 5
    elif zj==1 and sl:
        fen += 3
elif zj and sl:
    fen += 2

if 0 <= fen < 25:
    print('VERY_WEAK')
elif 25 <= fen < 50:
    print('WEAK')
elif 50 <= fen < 60:
    print('AVERAGE')
elif 60 <= fen < 70:
    print('STRONG')
elif 70 <= fen < 80:
    print('VERY_STRONG')
elif 80 <= fen < 90:
    print('SECURE')
elif fen >= 90:
    print('VERY_SECURE')



全部评论

相关推荐

专心打鱼:互联网搬运工,贴子都要偷
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务