티스토리 뷰
대문자와 소문자를 구분하기 때문에 따로따로 더해주어야 한다.
def numPY(s):
if s.count('p')+s.count('P') == s.count('y')+s.count('Y'):
return True
else:
return False
# 아래는 테스트로 출력해 보기 위한 코드입니다.
print( numPY("pPoooyY") )
print( numPY("Pyy") )'문제 풀이 > Programmers' 카테고리의 다른 글
| [python3][level 1] 정수제곱근판별하기 (0) | 2018.04.10 |
|---|---|
| [python3][level 1] 짝수와 홀수 (0) | 2018.04.10 |
| [python3][level 1] 문자열 다루기 기본 (0) | 2018.04.10 |
| [python3][level 1] 자릿수더하기 (0) | 2018.04.10 |
| [python3][level 1] 가운데 글자 가져오기 (0) | 2018.04.10 |
댓글