스크립트
[코딩테스트 입문] 편지
변군이글루
2022. 10. 23. 12:23
반응형
편지
1안) solution.py
def solution(message):
answer = 0
answer = len(message) * 2
return answer
2안) solution.py
def solution(message):
answer = 0
assert 1 <= len(message) <= 50, "out of scope"
answer = len(message) * 2
return answer
출처 - 프로그래머스(코딩테스트 연습) : https://school.programmers.co.kr/learn/courses/30/lessons/120898
demo_ref_keyword_assert2.py 편집
vim demo_ref_keyword_assert2.py
x = "hello"
#if condition returns False, AssertionError is raised:
assert x == "goodbye", "x should be 'hello'
참고URL
- python(w3schools.com) https://www.w3schools.com/python/ref_keyword_assert.asp
728x90
반응형