题解 | 密码强度等级

密码强度等级

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

from re import T
import string
s = input()
set_s = set(s)
res = 0

if len(s)<=4:
    res += 5
elif len(s)<=7:
    res += 10
else:
    res += 25
#print(res)
zb_f = zm_f = n_f = f_f = False

s_all = set(string.ascii_letters)
B = set(string.ascii_uppercase)
S = set(string.ascii_lowercase)

if len(B.intersection(set_s))>0:
    res += 10
    zb_f = True
if len(S.intersection(set_s))>0:
    res += 10
    zm_f = True
#print(res)
num_set = {str(i) for i in range(10)}

num_count = len(num_set.intersection(set_s))

if num_count > 1 :
    res += 20
    n_f = True
elif num_count == 1:
    res+=10
    n_f = True
#print(res)
fu_set = {i for i in """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""}

fu_count = len(fu_set.intersection(set_s))

if fu_count > 1 :
    res += 25
    f_f = True
elif fu_count == 1:
    res+=10
    f_f = True
#print(res)
if zb_f and zm_f and f_f and n_f:
    res += 5
elif (zb_f or zm_f)  and f_f and n_f:
    res += 3
elif (zb_f or zm_f)  and n_f:
    res += 2
#print(res)
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")
elif res >=0:
    print("VERY_WEAK")

全部评论

相关推荐

05-07 19:10
已编辑
中国科学技术大学 C++
silly01:现在先去 momenta,8-9月去鹅找日常实习,八股文算法背好了你这随便进。不过建议补充一下后端知识,MySQL、Redis看下八股,再补个6824,加点go后台的技术栈,9月随便进大厂。CPP后端只能来WXG
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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