鱼C论坛

 找回密码
 立即注册

【Python学习笔记】密码等级评级

已有 294 次阅读2016-12-20 19:47

自编代码:
print 'Please set your passwords:',
passwd = raw_input()
passlen = len(passwd)
str1 = list(r'''`!@#$%^&*()_+-=/*{}[]\|'";:/?,.<>''')
str2 = [str(i) for i in range(0,10)]
str3 = [chr(i) for i in range(97,123)] + [chr(i) for i in range(65,91)]

#contain speacial special charater
spech = False
for each in str1:
    if each in passwd:
        spech = True
        break

#contain number
num = False
for each in str2:
    if each in passwd:
        num = True
        break

#contain speacial letter
lett= False
for each in str3:
    if each in passwd:
        lett = True
        break

 
if passlen <= 8 or passwd.isdigit() or passwd.isalpha():
    print 'The Security Level is Low'
elif passlen >= 16 and spech and num and lett:
    print 'The Security Level is High'
elif spech and (not num) and (not lett):
    print "what's wrong with you?"
else:
    print 'The Security Level is Middle'
    

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-7-16 19:01

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

返回顶部