Skip to content

Instantly share code, notes, and snippets.

@adimyth
Created October 19, 2022 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adimyth/eb515b2dd2c8e9e9accf076665cffc39 to your computer and use it in GitHub Desktop.
Save adimyth/eb515b2dd2c8e9e9accf076665cffc39 to your computer and use it in GitHub Desktop.
Some random assignment
def is_illegal(input):
words = input.split(" ")
for word in words:
if word in "ENGLISH_WORDS":
return "ILLEGAL"
for char in word:
if char in [" ", "\n", "\t"]:
return "ILLEGAL"
return None
def is_weak(input):
if is_illegal(input) is not None:
if len(input) < 8:
return "WEAK"
word = input.rstrip('0123456789')
if word in "ENGLISH_WORDS":
return "WEAK"
def is_strong(input):
if is_illegal(input) is not None:
if len(input) >= 12 and (len(set(input).intersection(set("ABCD...."))) > 0) and ():
return "STRONG"
return None
def password_strength(input):
if is_illegal(input):
return "ILLEGAL"
elif is_weak(input):
return "WEAK"
elif is_strong(input):
return "STRONG"
else:
return "MEDIUM"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment