Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for House Password by lukasz.bogaczynski
digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
def checkio(password):
if len(password) < 10:
return False
has_digit = False
has_lower_case = False
has_upper_case = False
for char in password:
if has_digit and has_lower_case and has_upper_case:
return True
if char in digits:
has_digit = True
else:
if not has_lower_case:
has_lower_case = ord(char) >= 97
if not has_upper_case:
has_upper_case = ord(char) <= 90
if has_digit and has_lower_case and has_upper_case:
return True
return False
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"
print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")
Nov. 2, 2017