A sign-up form has already inspected a password and knows three facts about it: its length, whether it contains a digit (has_digit) and whether it contains a symbol (has_symbol). Write password_verdict(length, has_digit, has_symbol) that returns:
"weak"if the length is below 8, no matter what else is true"strong"if it has both a digit and a symbol"medium"if it has exactly one of those two"weak"if it has neither
Examples
Input: length = 12, has_digit = True, has_symbol = True
Output: "strong"
Input: length = 6, has_digit = True, has_symbol = True
Output: "weak"
Input: length = 10, has_digit = True, has_symbol = False
Output: "medium"
Constraints
0 <= length <= 200has_digitandhas_symbolare booleans
Goals
- Combine boolean inputs with and/or
- Apply a rule that overrides all others