Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions PASSWORD RELATED/password-validator/PASSWORD_VALIDATOR.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def passwordValidator():
print('\nYour password should: ')
print('\t- Have a minimum length of 6;')
print('\t- Have a maximum length of 12;')
print('\t- Contain at least an uppercase letter or a lowercase letter')
print('\t- Contain at least an uppercase letter;')
print('\t-Contain at least a lowercase letter;')
print('\t- Contain at least a number;')
print('\t- Contain at least a special character (such as @,+,£,$,%,*^,etc);')
print('\t- Not contain space(s).')
Expand All @@ -24,9 +25,13 @@ def passwordValidator():
if ' ' in userPassword:
message = 'Invalid Password..your password shouldn\'t contain space(s)'
return message
if not any(i in string.ascii_letters for i in userPassword):
if not any(i in string.ascii_uppercase for i in userPassword):
message = 'Invalid Password..your password should contain at least '
message += 'an uppercase letter and a lowercase letter'
message += 'an uppercase letter'
return message
if not any(i in string.ascii_lowercase for i in userPassword):
message = 'Invalid Password..your password should contain at least '
message += 'a lowercase letter'
return message
if not any(i in string.digits for i in userPassword):
message = 'Invalid Password..your password should contain at least a number'
Expand All @@ -38,4 +43,4 @@ def passwordValidator():
return 'Valid Password!'

my_password = passwordValidator()
print(my_password)
print(my_password)
3 changes: 2 additions & 1 deletion PASSWORD RELATED/password-validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
This program validates passwords to match specific rules. A valid password is one that conforms to the following rules:
- Minimum length is 6;
- Maximum length is 12;
- Contains at least an uppercase letter or a lowercase letter
- Contains at least an uppercase letter
- contains at least a lowercase letter
- Contains at least a number;
- Contains at least a special character (such as @,+,£,$,%,*^,etc);
- Doesn't contain space(s).
Expand Down