Aug-27-2017, 03:38 PM
Please use proper indentation and formatting. I had to indent your code and it works just fine.
incorrectPass = False while not incorrectPass: password = (input("Please enter a password between 6 and 12 characters")) length = len(password) if len (password) <6 or len(password)>12: print ("Password needs to be between 6 and 12 characters, Password entered is only", length, "characters long") else: #setflag for strength test lowerCase = 0 upperCase= 0 digitCase= 0 for ch in password: if ch.islower(): lowerCase = 1 if ch.isupper(): upperCase= 1 if ch.isdigit(): digitCase= 1 #Strength ouput passwordStrength = upperCase + lowerCase + digitCase if passwordStrength ==1: print ("This is a weak password") elif passwordStrength ==2: print ("This is a medium password") if passwordStrength ==3: print ("This is a strong password") incorrectPass = True