Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
auh8Chatbot/password.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
41 lines (24 sloc)
866 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
# 1. At least 2 letter between [a-z] | |
# 2. At least 1 number between [0-9] | |
# 3. At least 1 letter between [A-Z] | |
# 4. At least 2 character from [$!#@] | |
# 5. Minimum length of transaction password: 8 | |
# 6. Maximum length of transaction password: 16 | |
user_input = input("Please enter a password:") | |
def check_password_validity( user_input ) : | |
# Condition 1 | |
if len( re.findall( r'[a-z]', user_input ) ) < 2 : | |
return False | |
if len( re.findall( r'[0-9]', user_input ) ) < 1 : | |
return False | |
if len( re.findall( r'[A-Z]', user_input ) ) < 1 : | |
return False | |
if len( re.findall( r'[$!#@]', user_input ) ) < 2 : | |
return False | |
if len( user_input ) < 8 : | |
return False | |
if len( user_input ) > 16 : | |
return False | |
return True | |
print(check_password_validity(user_input)) |