You are viewing a single comment's thread. Return to all comments →
def minimumNumber(n, password): digits, lower_case, upper_case, special_ch = 0, 0 ,0, 0 for sign in password: if sign.isnumeric(): digits = 1 elif sign.islower(): lower_case = 1 elif sign.isupper(): upper_case = 1 elif sign in "!@#$%^&*()-+": special_ch = 1 result = [digits, lower_case, upper_case, special_ch] missing = 4 - sum(result) password_length = len(password) if password_length >= 6: if all(result): return 0 return missing else: if password_length + missing >= 6: return missing return 6 - (password_length + missing) + missing
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Strong Password
You are viewing a single comment's thread. Return to all comments →