(password)
| 1 | import string |
| 2 | |
| 3 | def check_password_strength(password): |
| 4 | strength = 0 |
| 5 | |
| 6 | # Criteria 1: Length (Must be at least 8 characters) |
| 7 | if len(password) >= 8: |
| 8 | strength += 1 |
| 9 | |
| 10 | # Criteria 2: Must contain Digits (0-9) |
| 11 | has_digit = False |
| 12 | for char in password: |
| 13 | if char.isdigit(): |
| 14 | has_digit = True |
| 15 | break |
| 16 | if has_digit: |
| 17 | strength += 1 |
| 18 | |
| 19 | # Criteria 3: Must contain Uppercase Letters (A-Z) |
| 20 | has_upper = False |
| 21 | for char in password: |
| 22 | if char.isupper(): |
| 23 | has_upper = True |
| 24 | break |
| 25 | if has_upper: |
| 26 | strength += 1 |
| 27 | |
| 28 | return strength |
| 29 | |
| 30 | if __name__ == "__main__": |
| 31 | print("--- Password Strength Checker ---") |
nothing calls this directly
no outgoing calls
no test coverage detected