list1=['0','1','2','3','4','5','6','7','8','9']
list2=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
list3=['!','@','#',','%','^','&','*','(',')','_','=','-','/',',','.','?','<','>',';',':','[',']','{','}','|']
code=input('请输入需要检查的密码组合:')
def pswresult(code):
flag_alp = flag_num =flag_infi =flag= 0
for each in code:
if each in list1:
flag_num=1
for each in code:
if each in list2:
flag_alp=1
for each in code:
if each in list3:
flag_infi=1
flag = flag_alp+ flag_infi+flag_num
if len(code) >= 16 and flag ==3 :
print("当前密码符合要求,评定为高级")
else:
print("当前密码符合要求,评定为中级")
def main(code):
if len(code) < 8 :
print("当前密码长度不符合要求。")
else:
if code[0] not in list2 :
print("当前密码不符合要求,要求首字母为小写字母")
else:
pswresult(code)
main(code)