Editor

Password Rules

#584 · Strings · Intermediate · Find and fix · 60 XP · about 8 min

A sign-up form accepts a password only when it is at least 8 characters long and has at least one uppercase letter, at least one lowercase letter and at least one digit. is_strong(password) should return True when all four rules are met and False otherwise.

The code in the editor has two bugs. 'Abcdefg1' meets every rule but is rejected, while 'abcdefgh1', which has no uppercase letter, is accepted.

Examples

is_strong('Secret123x')  # returns True
is_strong('Abcdefg1')    # returns True
is_strong('abcdefgh1')   # returns False
is_strong('Short1A')     # returns False

'Short1A' has every kind of character but only 7 of them.

Constraints

  • password has 0 to 100 characters.

Fastest solvers

Leaderboard

First solves only, ranked by stars and then time.