Skip to content

Commit

Permalink
Added relevant comments to code
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeSadhu committed Oct 1, 2020
1 parent ec25682 commit b5c7bfa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Password_Strength_Checker/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
pwd = input()
pwdLen = len(pwd)

if (pwdLen < 8):
if (pwdLen < 8): # check if password length is too short (less than 8 digits)
tooShort = True

def isDigit(i):
def isDigit(i): # check if character is a digit
if (i >= '0' and i <= '9'):
return True
else:
return False

for i in range (pwdLen):
if pwd[i].islower() or pwd[i].isupper():
if pwd[i].islower() or pwd[i].isupper(): # check if character is an upper/lowercase alphabet
points += 1
elif isDigit(pwd[i]):
digits += 1
else:
specs += 1
specs += 1 # if character isn't alphabet or digit, we'll assume it's a symbol/special character

if specs < 2:
print("Password must contain at least 2 special characters!")
Expand Down

0 comments on commit b5c7bfa

Please sign in to comment.