s
는 길이 1 이상, 길이 8 이하인 문자열입니다.s | result |
---|---|
"a234" | false |
"1234" | true |
def solution(s): if (len(s) == 4 or len(s) == 6) and s.isdigit() == True: answer = True else: answer = False return answer
풀이
isdigit()
함수를 사용해 문자가 있는지 판별결과
def alpha_string46(s):
return s.isdigit() and len(s) in (4, 6)