题解 | #密码强度等级#


"""
思路:将五个得分版块成绩汇总即可
"""
s = input()
res = 0
# 1.长度
if len(s) >= 8:
    res += 25
elif len(s) >= 5:
    res += 10
else:
    res += 5
# 2.字母
la = []
lu = []
ll = []
ln = []
for i in s:
    if i.isalpha():
        la.append(1)
    if i.isupper():
        lu.append(1)
    elif i.islower():
        ll.append(1)
    else:
        ln.append(1)
if sum(ln) == len(s):
    res += 0
elif sum(lu) == sum(la) or sum(ll) == sum(la):
    res += 10
else:
    res += 20
# 3.数字
ld = []
for i in s:
    if i.isdigit():
        ld.append(int(i))
if sum(ld) == 1:
    res += 10
elif sum(ld) > 1:
    res += 20
else:
    res += 0
# 4.符号
if len(ln) - len(ld) == 1:
    res += 10
elif len(ln) - len(ld) > 1:
    res += 25
else:
    res += 0
# 5.奖励
if (len(lu) > 0) and (len(ll) > 0) and (len(ld) > 0) and (len(ln) - len(ld) > 0):
    res += 5
elif (len(lu) + len(ll) > 0) and (len(ld) > 0) and (len(ln) - len(ld) > 0):
    res += 3
elif (len(lu) + len(ll) > 0) and (len(ld) > 0):
    res += 2
else:
    res += 0
# 输出结果
if res >= 90:
    print("VERY_SECURE")
elif res >= 80:
    print("SECURE")
elif res >= 70:
    print("VERY_STRONG")
elif res >= 60:
    print("STRONG")
elif res >= 50:
    print("AVERAGE")
elif res >= 25:
    print("WEAK")
else:
    print("VERY_WEAK")


全部评论

相关推荐

不愿透露姓名的神秘牛友
07-02 15:39
希望奇迹发生的布莱克...:真的是 现在卷实习就是没苦硬吃
点赞 评论 收藏
分享
06-07 12:20
新余学院 Java
点赞 评论 收藏
分享
星辰再现:裁员给校招生腾地方
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-07 12:04
毕业生招你惹你了,问一个发薪日来一句别看网上乱七八糟的你看哪个工作没有固定发薪日扭头就取消了面试就问了一句公司都是这个态度吗还搞上人身攻击了...
程序员小白条:呃呃呃,都还没面试,我都不会问这么细,何况通不通过,去不去都另说,你没实力和学历的话,在外面就这样,说实话没直接已读不回就不错了,浪费时间基本上
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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