WeCodeAcademy

Practice: A Password Checker

Put the ideas together. Build a checker that scores a password, and flags the weak habits: too short, not enough variety, a very common choice, or built from the user's own name. Remember the real lesson from earlier: length and randomness matter most, so the checker rewards length.

Examplepython
Open in editor »
Quick check

Which password is likely stronger?

Your turn: write the code

Write strength(password) returning 'weak' if it is shorter than 8 characters, 'ok' if 8 to 11, and 'strong' if 12 or more. Print results for 'abc', 'abcdefghij' and 'abcdefghijklmn', one per line.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.