Tech Study

Write a Python program to check the validity of a password

Introduction

Write a Python program to check the validity of a password.

Validation

At least 1 letter between [a-z] and 1 letter between [A-Z]

At least 1 number between [0-9]

At least 1 character from [$#@]

Minimum length 6 characters

Maximum length 16 characters

I have used python 3.7 compiler for debugging purpose.

import re
password= input("Input your password: ")
x = True
while x:  
    if (len(password)<6 or len(password)>12):
        break
    elif not re.search("[a-z]",password):
        break
    elif not re.search("[0-9]",password):
        break
    elif not re.search("[A-Z]",password):
        break
    elif not re.search("[$#@]",password):
        break
    elif re.search("\s",password):
        break
    else:
        print("Valid Password")
        x=False
        break
 
if x:
    print("Not a Valid Password")

Result

Write a Python program to check the validity of a password
Write a Python program to check the validity of a password

TaggedWrite a Python program to check the validity of a password

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more