https://school.programmers.co.kr/learn/courses/30/lessons/12916
def solution(s):
answer = True
countp=0
county=0
for i in range(len(s)):
if s[i] == 'p' or s[i] =='P':
countp += 1
elif s[i] == 'y' or s[i] == 'Y':
county += 1
if countp == 0 and county ==0:
return True
else:
if countp == county:
return True
else:
return False
'Coding Test > 프로그래머스' 카테고리의 다른 글
[Level 1] / [Python] 문자열을 정수로 바꾸기 (0) | 2022.10.12 |
---|---|
[Level 1] / [Python] 하샤드 수 (0) | 2022.10.12 |
[Level 1] / [Python] 정수 제곱근 판별 (0) | 2022.10.12 |
[Level 1] / [Python] 자연수 뒤집어 배열로 만들기 (0) | 2022.10.12 |
[Level 1] / [Python] 자릿수 더하기 (0) | 2022.10.12 |