I\'ve looked at the other post similar to my question, Password check- Python 3, except my question involves checking if the password contains both uppercase and lower case
Answer to question Break line not executing marked as duplicated:
password = input('Enter your password')
password_letters = list(password)
upper = False
lower = False
name = 'Papa'
surname = 'Johns'
for letter in password_letters:
if letter.isupper():
upper = True
elif letter.islower():
lower = True
if upper and lower:
break
if len(password) <= 5:
print('password is to short')
elif name.lower() in password.lower() or surname.lower() in password.lower():
print('You cannot have first or last name in password')
elif not (upper and lower):
print('You must have both upper and lower case in password')
else:
print('Password is valid')