Created
October 19, 2022 10:46
-
-
Save adimyth/eb515b2dd2c8e9e9accf076665cffc39 to your computer and use it in GitHub Desktop.
Some random assignment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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