본문 바로가기

Python_Matter/Solve

Python Learn the basics Quiz 58

반응형

Q>

Stephan and Sophia forget about security and use simple passwords for everything.

(Stephan과 Sophia는 보안을 잊어 버리고 모든 것에 간단한 암호를 사용합니다.)

Help Nikola develop a password security check module.

(Nikola가 암호 보안 검사 모듈을 개발하도록 도와주세요.)

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.

(암호는 길이가 10 기호 이상이고 암호가 적어도 하나 이상이며 대문자와 소문자가 각각 하나씩 포함되어 있으면 충분히 강력합니다.)

The password contains only ASCII latin letters or digits.

(암호는 ASCII 라틴 문자 또는 숫자 만 포함합니다.)

 

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

 

How it is used: If you are worried about the security of your app or service, you can check your users' passwords for complexity.

(앱이나 서비스의 보안이 걱정된다면 사용자 비밀번호의 복잡성을 확인할 수 있습니다.)

You can use these skills to require that your users passwords meet more conditions (punctuations or unicode).

(이 기술을 사용하여 사용자 암호가 더 많은 조건 (구두점 또는 유니 코드)을 충족하도록 요구할 수 있습니다.)

 

Precondition:
re.match("[a-zA-Z0-9]+", password)
0 < len(password) ≤ 64

 

A>

def checkio(data: str) -> bool:

    #replace this for solution
    # data의 10글자가 안되면 False
    if len(data) < 10:
        return False

    # data가 모두 대문자면 Flase
    if data.upper() == data:
        return False

    # data가 모두 소문자면 False
    if data.lower() == data:
        return False

    # isdigit() : 문자열이 숫자이면 False
    # any() : 객체를 받아 어느 하나라도 True면 True 반환
    return any(c.isdigit() for c in data)

#Some hints
#Just check all conditions


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!")

 

O>

Coding complete? Click 'Check' to review your tests and earn cool rewards!

Process finished with exit code 0

 

S>

https://py.checkio.org/

반응형

'Python_Matter > Solve' 카테고리의 다른 글

Python Learn the basics Quiz 60  (0) 2019.06.12
Python Learn the basics Quiz 59  (0) 2019.06.12
Python Learn the basics Quiz 57  (0) 2019.06.12
Python Learn the basics Quiz 56  (0) 2019.06.12
Python Learn the basics Quiz 55  (0) 2019.06.11