Stephan and Sophia forget about security and use simple passwords for everything. Help Nikola develop a password security check module. The password will be considered strong enough if its length is greater than or equal to 10 symbols, it has at least one digit, as well as containing one uppercase letter and one lowercase letter in it. The password contains only ASCII latin letters or digits.
Input: A password as a string.
Output: Is the password safe or not as a boolean or any data type that can be converted and processed as a boolean. In the results you will see the converted results.
Example:
checkio('A1213pokl') == False
checkio('bAse730onE') == True
checkio('asasasasasasasaas') == False
checkio('QWERTYqwerty') == False
checkio('123456123456') == False
checkio('QwErTy911poqqqq') == True
* 10글자 이상으로 된 문자열이어야한다.
* 최소 하나의 숫자와 소문자, 대문자가 있어야한다.
* 문자열은 오직 대/소문자와 숫자로만 이루어져있다.
-풀이
def checkio(data: str) -> bool:
#10글자 미만이면 False
if len(data) < 10:
return False
data_digit = False
data_lower = False
data_upper = False
for x in data:
if x.isdigit():
data_digit = True
elif x.islower():
data_lower = True
elif x.isupper():
data_upper = True
# 전부 False면 True가 리턴
if data_digit and data_upper and data_lower:
return True
'취미생활 > CheckIO' 카테고리의 다른 글
[checkIO]Home 06.Sort Array by Element Frequency (0) | 2020.02.13 |
---|---|
[checkIO]Home 05.Non-unique Elements (0) | 2020.02.11 |
[checkIO]Home 04.Time Converter (24h to 12h) (0) | 2020.02.11 |
[checkIO]Home 03. The Most Wanted Letter (0) | 2020.02.09 |
[checkIO]Home 01.All the Same (1) | 2020.02.09 |