0
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

When I run my code it is able to see if I use my first and last name, but it is not able to determine if I have used both upper and lower case as if my password contains both it returns me with You must have both upper and lower case in password even though I have used both

So my question is why my code is not able to detect both upper and lower case letters in password. Why does my break line not execute

0 Answers0