프로그래머스 문자열 다루기 기본(프로그래머스 level1, 파이썬) KQNG 2018. 9. 19. 16:03 이웃추가 본문 기타 기능 이번에 포스팅할 문제는 프로그래머스 코딩테스트 연습의 1단계인 문자열 다루기 기본 이라는 문제입니다. 문제는 다음과 같습니다.
(문자열의 길이가 4 또는 6) and (모두 숫자)의 논리연산을 하면 되는 문제입니다. 코드는 다음과 같습니다. def solution(s): answer = True is4or6 = True isAllNum = True #...1 sLength = len(s) if(not (sLength == 4 or sLength == 6)): is4or6 = False #...2 for i in range(sLength): if not (s[i] >= '0' and s[i] <= '9'): isAllNum = False #...3 answer = is4or6 and isAllNum return answer ...1) 먼저 문자열 길이...
#
algorithm
#
프로그래머스
#
파이썬
#
코딩테스트
#
알고리즘
#
문자열다루기기본
#
python
#
programming
#
coding
#
프로그래밍
원문 링크 : 문자열 다루기 기본(프로그래머스 level1, 파이썬)