python-checkio/Home/house-password.py
2019-12-18 17:30:47 +01:00

30 lines
1.0 KiB
Python

# migrated from python 2.7
def checkio(data):
numbers = ["0","1","2","3","4","5","6","7","8","9"]
alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t" ,"u", "v", "w", "x", "y", "z"]
beta = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T" ,"U", "V", "W", "X", "Y", "Z"]
if(len(data)<10):
return False
if(has(data, numbers) == False):
return False
if(has(data, alpha) == False):
return False
if(has(data, beta) == False):
return False
return True
def has(da, ar):
for c in da:
if(c in ar):
return True
return False
if __name__ == '__main__':
assert checkio('A1213pokl')==False, 'First'
assert checkio('bAse730onE4')==True, 'Second'
assert checkio('asasasasasasasaas')==False, 'Third'
assert checkio('QWERTYqwerty')==False, 'Fourth'
assert checkio('123456123456')==False, 'Fifth'
assert checkio('QwErTy911poqqqq')==True, 'Sixth'
print('All ok')