PYTHON代码
知识点:isdigit()函数、isupper()函数、条件判断if 等等
[mw_shl_code=python,true]while True:
msgs = []
psw = input("请输入密码:")
if not any([i.isdigit() for i in psw]):
msgs.append("需要至少一个数字")
if not any([i.isupper() for i in psw]):
msgs.append("需要至少一个大写字母")
if len(psw) < 6:
msgs.append("密码长度至少是6位数")
if len(msgs) == 0:
print("密码验证通过")
break
else:
print("密码不通过,有如下原因")
for note in msgs:
print("*",note)[/mw_shl_code]