This repository has been archived by the owner on Dec 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #383 from UkaniVedant/main
Create PasswordValidator.py
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
def password_check(passwd): | ||
|
||
SpecialSym =['$', '@', '#', '%'] | ||
val = True | ||
|
||
if len(passwd) < 6: | ||
print('Invalid Password: length should be at least 6') | ||
val = False | ||
return val | ||
|
||
if len(passwd) > 20: | ||
print('Invalid Password: length should be not be greater than 8') | ||
val = False | ||
return val | ||
|
||
if not any(char.isdigit() for char in passwd): | ||
print('Invalid Password: Password should have at least one numeral') | ||
val = False | ||
return val | ||
|
||
if not any(char.isupper() for char in passwd): | ||
print('Invalid Password: Password should have at least one uppercase letter') | ||
val = False | ||
return val | ||
|
||
if not any(char.islower() for char in passwd): | ||
print('Invalid Password: Password should have at least one lowercase letter') | ||
val = False | ||
return val | ||
|
||
if not any(char in SpecialSym for char in passwd): | ||
print('Invalid Password: Password should have at least one of the symbols $@#') | ||
val = False | ||
return val | ||
|
||
if val: | ||
print("valid Password !!") | ||
|
||
|
||
if __name__ == '__main__': | ||
passwd = input("Enter your Password: ") | ||
password_check(passwd) | ||
|
||
|
||
if (password_check(passwd)): | ||
print("Password is valid") | ||
else: | ||
print("Invalid Password !!") |