Editor

Test a Password Strength Check

Write the tests · Intermediate · about 12 min

is_strong(password) returns True when a password has at least 8 characters and contains at least one digit, at least one uppercase letter and at least one lowercase letter. Otherwise it returns False.

Write test_ functions with assert that pass on a correct version and fail on broken ones.

Examples

is_strong("Sunny2026")    # True
is_strong("sunny2026")    # False, no uppercase letter
is_strong("Sun2")         # False, too short
def test_good_password():
assert is_strong("Sunny2026") == True
The solution opens after your first Check.