Ask coding questions

← Back to all posts
how do i add a scoring system in python to check the strength of the password
mathewdunn (0)

how do i add a scoring system in python to check the strength of the password

Comments
hotnewtop
MrVoo (102)

You could try something like this:

password = input('> ')
strength = 0
letters = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'
for letter in password:
  if letter in letters:
    strength += 1
  elif letter in '1234567890':
    strength += 2
  else:
    strength += 3
print(f'Password strength: {strength}')

Don't use this exact code though :>