Programmers/프로그래머스-중복된 문자 제거-python

cosmos·2022년 11월 10일
0
post-thumbnail

문제

코드

# https://school.programmers.co.kr/learn/courses/30/lessons/120888/
# programmers, level0: 중복된 문자 제거, python3
def solution(my_string: str) -> str:
    dict = {}

    for x in my_string:
        if x not in dict:
            dict[x] = 1

    return "".join(map(str, [x for x in dict]))

if __name__ == '__main__':
    print(solution("people"))
    print(solution("We are the world"))

결과

출처 & 깃허브

프로그래머스
github

0개의 댓글