Skip to content

Instantly share code, notes, and snippets.

@codeboy101
Last active January 14, 2016 09:27
Show Gist options
  • Select an option

  • Save codeboy101/a1d773361ef7960ad7ab to your computer and use it in GitHub Desktop.

Select an option

Save codeboy101/a1d773361ef7960ad7ab to your computer and use it in GitHub Desktop.
import time
special_char = ['?' , '!' , '.' , '/']
user_password = input("enter password: ")
pass_strength = len(user_password) / 2
strength_comments = ['weak' , 'good' , 'strong']
for char in user_password :
if char in special_char :
pass_strength += 1
if char == char.upper() :
pass_strength += 0.5
if len(user_password) > 8 :
pass_strength += 1
if pass_strength > 10 :
print("{} {}".format(pass_strength,strength_comments[2]))
elif pass_strength == 5 :
print("{} {}".format(pass_strength,strength_comments[1]))
elif pass_strength < 5 :
print("{} {}".format(pass_strength,strength_comments[0]))
time.sleep(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment