Password validations is something that is pretty common in most of all the applications that are built right? This time we are looking at some validations for password using Python codes.
Below is the lambda function to test for the validity of password.
password = lambda x : len(x) > 5 and len(x) < 10 and string.punctuation not in x and ” ” not in x
Below, is another way of doing the password validation.

Although other things are pretty easy, the catch here is –
string.punctuation – Well, this is a file present inside Python which gives you all the special characters present in the Python file.
Happy Learning 🙂

Leave a comment