题解 | #密码强度等级#

密码强度等级

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

= input()

zimu = []

nums = []

fuhao = []

count = 0

for i in s:

    if i.isalpha():

        zimu.append(i)

    elif i.isdigit():

        nums.append(i)

    else:

        fuhao.append(i)

if len(s)<=4:

    count += 5

elif 5<=len(s)<=7:

    count += 10

else:

    count += 25

daxiao = 0

for i in zimu:

    if i.isupper():

        count += 10

        daxiao += 1

        break

for i in zimu:

    if i.islower():

        count += 10

        daxiao += 1

        break

if len(nums)==1:

    count += 10

elif len(nums)>1:

    count += 20

if len(fuhao)==1:

    count += 10

elif len(fuhao)>1:

    count += 25

if daxiao==2 and len(nums)>=1 and len(fuhao)>=1:

    count += 5

elif daxiao==1 and len(nums)>=1 and len(fuhao)>=1:

    count += 3

elif daxiao>=1 and len(nums)>=1 and len(fuhao)==0:

    count += 2

if count>=90:

    print('VERY_SECURE')

elif count>=80:

    print('SECURE')

elif count>=70:

    print('VERY_STRONG')

elif count>=60:

    print('STRONG')

elif count>=50:

    print('AVERAGE')

elif count>=25:

    print('WEAK')

else:

    print('VERY_WEAK')

全部评论

相关推荐

宇智波爱学习:我还没收到笔试
投递荣耀等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务