Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shorting Code down
#8
I believe this captures your idea as far as I understand it:
password = input("Enter password: ")

min_size = 6
strength = ["Too short", "Weak", "Medium", "Strong"]

security = 0
if len(password) >= min_size:
    if any(char.isdigit() for char in password):
        security += 1
    if any(char.isupper() for char in password):
        security += 1
    if any(char.islower() for char in password):
        security += 1

print(strength[security])
Seem correct?
Reply


Messages In This Thread
Shorting Code down - by gh01 - Oct-10-2016, 06:17 PM
RE: Shorting Code down - by Mekire - Oct-10-2016, 06:21 PM
RE: Shorting Code down - by micseydel - Oct-10-2016, 06:29 PM
RE: Shorting Code down - by Mekire - Oct-10-2016, 06:37 PM
RE: Shorting Code down - by gh01 - Oct-10-2016, 06:31 PM
RE: Shorting Code down - by micseydel - Oct-10-2016, 06:34 PM
RE: Shorting Code down - by gh01 - Oct-10-2016, 06:50 PM
RE: Shorting Code down - by Mekire - Oct-10-2016, 06:51 PM
RE: Shorting Code down - by micseydel - Oct-10-2016, 06:54 PM
RE: Shorting Code down - by gh01 - Oct-10-2016, 06:55 PM
RE: Shorting Code down - by Mekire - Oct-10-2016, 06:58 PM
RE: Shorting Code down - by gh01 - Oct-10-2016, 07:08 PM
RE: Shorting Code down - by sparkz_alot - Oct-10-2016, 08:52 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020