我正在尝试创建一个要求您输入密码的系统。如果都是 lower、upper 或 num,则打印 weak,如果是其中两个条件,则为 med,如果都满足,则为 strong。它似乎不起作用。
弱者和强者起作用,但媒介却没有。
我不知道我哪里出错了。
def password():
print ('enter password')
print ()
print ()
print ('the password must be at least 6, and no more than 12 characters long')
print ()
password = input ('type your password ....')
weak = 'weak'
med = 'medium'
strong = 'strong'
if len(password) >12:
print ('password is too long It must be between 6 and 12 characters')
elif len(password) <6:
print ('password is too short It must be between 6 and 12 characters')
elif len(password) >=6 and len(password) <= 12:
print ('password ok')
if password.lower()== password or password.upper()==password or password.isalnum()==password:
print ('password is', weak)
elif password.lower()== password and password.upper()==password or password.isalnum()==password:
print ('password is', med)
else:
password.lower()== password and password.upper()==password and password.isalnum()==password
print ('password is', strong)