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

yewon Lee·2023년 9월 11일
0


😎코딩테스트 연습>연습문제>>문자열 다루기 기본


📘 문제풀이


숫자판별 -> s.isdigit()
문자판별 -> s.isalpha()


문제를 잘 읽자!

문자열의 길이가 4 또는 6이고, 모두 숫자일 때 True를 반환
def solution(s):
    answer = False
    if (len(s) == 4 or len(s) == 6) and s.isdigit():
        return True
    return answer
profile
시작

0개의 댓글

Powered by GraphCDN, the GraphQL CDN