Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python password checker

#If you are asking for "validity of  new password",

# Python program to check validation of password
# Module of regular expression is used with search()
import re
password = "R@m@_f0rtu9e$"
flag = 0
while True:  
    if (len(password)<8):
        flag = -1
        break
    elif not re.search("[a-z]", password):
        flag = -1
        break
    elif not re.search("[A-Z]", password):
        flag = -1
        break
    elif not re.search("[0-9]", password):
        flag = -1
        break
    elif not re.search("[_@$]", password):
        flag = -1
        break
    elif re.search("s", password):
        flag = -1
        break
    else:
        flag = 0
        print("Valid Password")
        break
  
if flag ==-1:
    print("Not a Valid Password")
    
    
#if you want to check an inputted password if it matches a predetermined password,

word = 'welovegrepper'

def check_password(input):
    if input == word:
        print("granted")
    else:
        print("denied")
        
while True:
    print("type password")
    cmd = input()
    check_password(cmd)
Comment

PREVIOUS NEXT
Code Example
Python :: copy files to a directory using text file 
Python :: random 2 n program in python 
Python :: pip install covid 
Python :: How to join train and Test dataset in python 
Python :: feature to determine image too dark opencv 
Python :: decimal to binary in python 
Python :: calculate days between two dates using python 
Python :: relativefrequencies of the unique values pandas 
Python :: print inline output in python 
Python :: Returns the first n rows 
Python :: Iterate through characters of a string in python 
Python :: django only certain columns from database 
Python :: how to add percentage in countplot 
Python :: if number is divisible by 3 python 
Python :: remove zeros from decimal python 
Python :: get turtle pos 
Python :: Python NumPy copyto function example 
Python :: get last 3 in array python 
Python :: django textfield 
Python :: cv2 blue color range 
Python :: print colored text in python 
Python :: string slices 
Python :: python timer 
Python :: pandas replace nan with none 
Python :: df empty python 
Python :: python list pop vs remove 
Python :: python code for string title 
Python :: import all csv as append dataframes python 
Python :: area of trapezium 
Python :: datetime.time to seconds 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =