Skip to content

Commit 9ef1548

Browse files
Update securepass/password.py
Co-authored-by: Shamith Nakka <shamith301102@gmail.com>
1 parent 5c12671 commit 9ef1548

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

securepass/password.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,16 @@ def password_report(password: str) -> str:
7979
recommended_length = 8
8080

8181
length = len(password)
82-
upper = sum(1 for ch in password if ch.isupper())
83-
lower = sum(1 for ch in password if ch.islower())
84-
digits = sum(1 for ch in password if ch.isdigit())
85-
symbols = sum(1 for ch in password if not ch.isalnum())
82+
upper = lower = digits = symbols = 0
83+
for letter in password:
84+
if letter.isupper():
85+
upper += 1
86+
elif letter.islower():
87+
lower += 1
88+
elif letter.isdigit():
89+
digits += 1
90+
else:
91+
symbols += 1
8692

8793
parts = []
8894

0 commit comments

Comments
 (0)