본문 바로가기
프로그래밍 공부

3. Python, CheckiO Elementary_Acceptable Password I

by 응_비 2020. 10. 22.

Elementary

English RU JA

You are at the beginning of a password series. Every mission is based on the previous one. Going forward the missions will become slightly more complex.

In this mission, you need to create a password verification function.

The verification condition is:

  • the length should be bigger than 6.
  • -> 길이가 6보다 크면 = Ture
  • -> 그렇지 않으면, False

Input: A string.

Output: A bool.

Example:

is_acceptable_password('short') == False

is_acceptable_password('muchlonger') == True

1

2

How it’s used: For a password verification form. Also it’s good to learn how the task can be evaluated.

 

-> Solve it

 

3. 조건에 따른 문제 해결하기(조건문)

3.1 boolean형과 비교/논리 연산자

3.1.1 boolean형

3.1.2 비교 연산자

3.1.3 논리 연산자

3.2 조건문

3.3 if-else 조건문

4. 여러 조건 다루기(심화 조건문)

4.1 중첩 조건문

4.2 if-elif-else 조건문

 

def is_acceptable_password(password: str) -> bool:
    return len(password) > 6


if __name__ == '__main__':
    print("Example:")
    print(is_acceptable_password('short'))

    # These "asserts" are used for self-checking and not for an auto-testing
    assert is_acceptable_password('short') == False
    assert is_acceptable_password('muchlonger') == True
    assert is_acceptable_password('ashort') == False
    print("Coding complete? Click 'Check' to earn cool rewards!")

댓글