Language/Python

[Python / 프로그래머스 level 1] 문자열 내 p와 y의 개수

ej503 2021. 6. 30. 08:01

def solution(s):
    s = s.lower()
    s = list(s)
    if s.count('p') == s.count('y'):
        return True
    elif s.count('p') == 0 and s.count('y') == 0:
        return True
    else:
        return False