Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for House Password by reviewboy
# migrated from python 2.7
def checkio(data):
# password strength criteria:
minLength = 10 # must be 10+ characters,
# must be alphanumeric (no special chars)
Digit = 0 # must have at least one digit
LC = 0 # must have at least one lowercase letter
UC = 0 # must have at least one uppercase letter
# parse password for character type counts (0 = False)
for c in data:
UC +=1 if c.islower() else UC
LC +=1 if c.isupper() else LC
Digit +=1 if c.isdigit() else Digit
strength = data.isalnum() and Digit and LC and UC and len(data) >= minLength
return bool(strength)
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio('A1213pokl') == False, "1st example"
assert checkio('bAse730onE4') == True, "2nd example"
assert checkio('asasasasasasasaas') == False, "3rd example"
assert checkio('QWERTYqwerty') == False, "4th example"
assert checkio('123456123456') == False, "5th example"
assert checkio('QwErTy911poqqqq') == True, "6th example"
Sept. 20, 2014
Comments: