← Back to challenges

Strong Password

PythonHardvalidationstrings

Instructions

Create a function that determines the minimum number of characters needed to make a strong password.

A password is considered strong if it satisfies the following criteria:

  • Its length is at least 6.
  • It contains at least one digit.
  • It contains at least one lowercase English character.
  • It contains at least one uppercase English character.
  • It contains at least one special character: !@#$%^&*()-+

Types of characters in a form you can paste into your solution:

numbers = "0123456789"
lower_case = "abcdefghijklmnopqrstuvwxyz"
upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
special_characters = "!@#$%^&*()-+"

Examples

strong_password(“Ed1”) ➞ 3

strong_password(“#Innokodakademija”) ➞ 1

strong_password("W1llth!spass?") ➞ 0

Notes

Try solving this without RegEx.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.