| Total Complexity | 1 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from re import search |
||
| 2 | |||
| 3 | |||
| 4 | def is_acceptable_password(password: str) -> bool: |
||
| 5 | return len(password) > 6 and bool(search(r'\d', password)) and bool(search(r'\D', password)) |
||
| 6 | |||
| 7 | |||
| 8 | if __name__ == "__main__": |
||
| 9 | # These "asserts" are used for self-checking and not for an auto-testing |
||
| 10 | assert is_acceptable_password("short") == False |
||
| 11 | assert is_acceptable_password("muchlonger") == False |
||
| 12 | assert is_acceptable_password("ashort") == False |
||
| 13 | assert is_acceptable_password("muchlonger5") == True |
||
| 14 | assert is_acceptable_password("sh5") == False |
||
| 15 | assert is_acceptable_password("1234567") == False |
||
| 16 | print("Coding complete? Click 'Check' to earn cool rewards!") |
||
| 17 |