while True:
password = input('Enter your password')
passwordlist = list(password)
upper=False
lower=False
for letters in passwordlist:
if letters == letters.upper():
upper = True
if letters == letters.lower():
lower = True
if len(password) <=5:
print('password is to short')
elif Name in password or Surname in password:
print('You cannot have first or last name in password')
elif upper == False or lower == False:
print('You must have both upper and lower case in password')
elif upper == True and lower == True:
print('Password is valid')
break
当我运行我的代码时,它能够看到我是否使用我的名字和姓氏,但它无法确定我是否同时使用大写和小写,就好像我的密码包含它同时返回{{{ 1}}即使我已经使用了两个
所以我的问题是为什么我的代码无法检测密码中的大写和小写字母。
为什么我的You must have both upper and lower case in password
行没有执行