I am creating a simple code to check if a password is secure. To be secure a password be at least 8 characters and have one special character. My code does not work properly when 8 characters are entered without a special character. How can I fix it?
#get password
password_in = input("Enter a secure password: ")
#check password is secure
special_ch = ['!', '@', '#', '$', '%', '^', '&', '*']
check = any(item in special_ch for item in password_in)
while len(password_in) <8 and check == False:
print("Password is not secure")
password_in = input("Please enter a secure password: ")