Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #383 from UkaniVedant/main
Browse files Browse the repository at this point in the history
Create PasswordValidator.py
  • Loading branch information
Almas-Ali authored Nov 13, 2022
2 parents a3928d7 + a6f4921 commit 544ffe5
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Python/PasswordValidator.py
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 !!")

0 comments on commit 544ffe5

Please sign in to comment.