Programming/프로그래머스

[프로그래머스] 문자열 다루기 기본

pental 2020. 10. 6. 15:12

Question

def solution(s):
    if len(s) == 4:
        if s.isdigit() == True:
            return True
        else :
            return False
    elif len(s) == 6:
        if s.isdigit() == True:
            return True
        else :
            return False
    else : 
        return False

isdigit 함수를 통해서 문자열이 숫자로만 이루어졌는지 확인할수 있다.