我如何进行这个循环,如果可能的话,我可以整理它?
l,a,b, = 0, 0, 0
password = str(input("Please enter a strong, 12 character password: "))
for i in password:
if password[0] or [1] or [2] or [3] or [4] or [5] or [6] or [7] or [8] or [9] or [10] or [11] or
[12].islower():
l+=1
if password[0] or [1] or [2] or [3] or [4] or [5] or [6] or [7] or [8] or [9] or [10] or [11] or
[12].isupper():
a+=1
if len(password) == 12:
b+=1
if l>=1 and a>=1 and b>=1:
print("valid password")
else:
print("invalid password")
- 清理程序代码:
l, a, b, = 0, 0, 0
password = str(input("Please enter a strong, 12 character password: "))
for i in password:
if i.islower():
l += 1
if i.isupper():
a += 1
if len(password) == 12:
b += 1
if l >= 1 and a >= 1 and b >= 1:
print("valid password")
else:
print("invalid password")
- 像"这样的非字母字符呢">