Programmer:)

(Python) 프로그래머스 : 문자열 내 p와 y의 개수 본문

프로그래머스 정복/Python

(Python) 프로그래머스 : 문자열 내 p와 y의 개수

ryeggg 2020. 6. 18. 12:40
반응형

def solution(s):
    answer = True
    s = s.lower()

    if s.count("p") == 0 and s.count("y") == 0:
        answer = True
    elif s.count("p") == s.count("y"):
        answer = True
    else:
        answer = False 

    return answer
반응형
Comments