인천의 자유인

[Python] 대문자와 소문자 -프로그래머스 본문

Python/Python코딩테스트

[Python] 대문자와 소문자 -프로그래머스

Youngook 2024. 4. 24. 09:34
728x90
반응형

 

 

나의 문제풀이

def solution(my_string):
    lst  = []
    for x in my_string:
        if not x.isupper():  #대문자가 아니라면...
            lst.append(x.upper())
        elif not x.islower(): #소문자가 아니라면...
            lst.append(x.lower())       
    return ''.join(lst)
728x90
반응형