|
楼主 |
发表于 2020-3-6 03:04:32
|
显示全部楼层
经过您的指点我写出来了 感谢!
def C():
print("1. 密码必须由数字、字母及特殊字符(仅限:~!@#$%^&*()_=-/,.?<>;:[]{}|\)三种组合\n2.密码只能由字母开头\n3.密码长度不能低于16位")
def m(ou):
print("您的密码等级为:%s"%ou)
def P(x,n):
for i in range(len(x)):
if x in n:
return True
else:
continue
number ="0123456789"
st = "qwertyuiopasfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
tf = r"~!@#$%^&*()_=-/,.?<>;:[]{}\|"
Hi = "高"
Mi = "中"
Li = "低"
val = input("请输入需要检查的密码组合: ")
leng = len(val)
if leng > 16:
if P(val,number) and P(val,st) and P(val,tf) and (val[0] in st):
m(Hi)
print("请继续保持")
elif 16 >= leng >8:
if P(val,number) and (P(val,st) or P(val,tf)):
m(Mi)
C()
else:
if leng <= 8:
m(Li)
C()
else:
m(Li)
C()
|
|