Program to check Strength of Password | Python3 program to check if a given password is strong or not . ; Checking lower alphabet in string ; Strength of password ; Driver code
def printStrongNess ( input_string ) : NEW_LINE INDENT n = len ( input_string ) NEW_LINE hasLower = False NEW_LINE hasUpper = False NEW_LINE hasDigit = False NEW_LINE specialChar = False NEW_LINE normalChars = " abcdefghijklmnopqrstu " NEW_LINE for i in range ( n ) : NEW_LINE INDENT if input_string [ i ] . islower ( ) : NEW_LINE INDENT hasLower = True NEW_LINE DEDENT if input_string [ i ] . isupper ( ) : NEW_LINE INDENT hasUpper = True NEW_LINE DEDENT if input_string [ i ] . isdigit ( ) : NEW_LINE INDENT hasDigit = True NEW_LINE DEDENT if input_string [ i ] not in normalChars : NEW_LINE INDENT specialChar = True NEW_LINE DEDENT DEDENT print ( " Strength ▁ of ▁ password : - " , end = " " ) NEW_LINE if ( hasLower and hasUpper and hasDigit and specialChar and n >= 8 ) : NEW_LINE INDENT print ( " Strong " ) NEW_LINE DEDENT elif ( ( hasLower or hasUpper ) and specialChar and n >= 6 ) : NEW_LINE INDENT print ( " Moderate " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Weak " ) NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT input_string = " GeeksforGeeks ! @12" NEW_LINE printStrongNess ( input_string ) NEW_LINE DEDENT