0
Password validation challenge
I can't figure out what's wrong with this code for the password validation challenge (if input has 7+ characters, 2+ of the following: !@#$%@* and 2+ numbers print "Strong", otherwise print "Weak"). It only failed 1 of the 13 test cases, and the one it failed is hidden. Help? password = list(input()) specialCharacters = 0 numbers = len(password) while True: if len(password) < 7: print("Weak") break for i in range(len(password)): if password[i] == "!" or "@" or "#" or "
quot; or "%" or "&" or "*": specialCharacters += 1 if specialCharacters < 2: print("Weak") break for i in range(len(password)): try: int(password[i]) except ValueError: numbers -= 1 if numbers < 2: print("Weak") break print("Strong") break2 Respostas
0
You missed to specify "password[i] ==" in front of all special characters except the first one.
You can also check with this:
if password[i] in ["!", "@", "#", "quot;, "%", "&", "*"]:
0
Oooh. I had had issues with that type of stuff before but wasn't really sure how to fix it or when it happened. Thanks!