题解 | #密码强度等级#

密码强度等级

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

各种if elif else,最笨的方法肯定有效

s=list(input())
count=0
if len(s)<5:
    count+=5
elif 4<len(s)<8:
    count+=10
else:
    count+=25
num_alp=0
num_upper=0
num_lower=0
for i in s:
    if i.isalpha():
        num_alp+=1
        if i.isupper():
            num_upper+=1
        elif i.islower():
            num_lower+=1
if num_upper>0 and num_lower>0:
    count+=20
elif num_upper==0 and num_lower>0:
    count+=10
elif num_upper>0 and num_lower==0:
    count+=10
else:
    count+=0
num_num=0
for i in s:
    if i.isdigit():
        num_num +=1
if num_num>1 :
    count+=20
elif num_num==1:
    count+=10
else:
    count+=0
num_str=0
for i in s:
    if i.isdigit()==False and i.isalpha()==False:
        num_str +=1
if num_str>1 :
    count+=25
elif num_str==1:
    count+=10
else:
    count+=0
if num_alp>0 and num_num>0 and num_str==0:
    count+=2
elif num_upper==0 and num_lower>0 and num_num>0 and num_str>0:
    count+=3
elif num_upper>0 and num_lower==0 and num_num>0 and num_str>0:
    count+=3
elif num_upper>0 and num_lower>0 and num_num>0 and num_str>0:
    count+=5

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

全部评论

相关推荐

大方的大熊猫准备进厂:1.教育背景:你希望从事什么专业的工作你的主修课就是什么;成绩优秀是你应该做的,没什么可描述的,成绩不优秀也许人家在大学忙着创业呢?(成绩优秀不一定是好事,只能说明多元化的大学你上成了高中,没有真正上明白大学,反而体现了你死板,不爱社交,没有别的突出能力) 2.实践经历:你想表达的意思没有说清楚。你是说你会个性化服务,还是你有实习经历。如果没有带来,经济收益,表彰,更好的发展前景,那你还不如说说提升了自己哪些技能。你说有人给你送锦旗我都能明白你优秀,但是你说你会xxxx,你说这话谁信,证据呢。 3.入伍经历:你描述的就是你的工作职责或者你应该做的,并没有体现出来你把这个事情做好了,而且入伍经历并不能证明你能干好你要应聘的工作,不如只写经历其余所有内容都不写。 4.荣誉技能:重点突出一下,但不要过多描述,这些荣誉的含金量懂得都懂。 重点:你要应聘什么工作(具体岗位,实习生不具体),你的期望薪资
点赞 评论 收藏
分享
05-19 15:21
已编辑
华南农业大学 Java
白火同学:你才沟通了200,说实话,北上广深杭这里面你连一座城市的互联网公司都没投满呢,更别说还有各种准一线二线城市了。等你沟通突破了三位数,还没结果再考虑转行的事吧。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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