Elementary
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!")
'프로그래밍 공부' 카테고리의 다른 글
5. *Python, CheckiO Elementary_End Zeros (0) | 2020.10.22 |
---|---|
4. Python, CheckiO Elementary_Number Length (0) | 2020.10.22 |
2. *Python, CheckiO Elementary_First Word (simplified) (0) | 2020.10.22 |
1. Python, CheckiO Elementary_Easy Unpack (0) | 2020.10.22 |
XML 기초개념- Relative Layout (0) | 2020.08.05 |
댓글