티스토리 뷰

1. 문제

 

 

2. 정답 코드

def solution(s):
    if (len(s) == 4 or len(s) == 6) and s.isdigit() :
        answer = True
    else :
        answer = False
    return answer
  • isdigit() 함수는 어떤 문자열이 숫자로만 이루어져 있는지 판별한다.
    • 사용법: 문자열.isdigit()
728x90