공부/코딩테스트

[프로그래머스] 튜플(파이썬)

ghhong 2022. 1. 13. 17:58

내답:

def solution(s):
    answer=[]
    s= s[2:-2]
    s=s.split('},{')
    s.sort(key=len)
    
    for i in s:
        i=i.split(',')
        for j in i:
            j=int(j)
            if j not in answer:
                answer.append(j)
    return answer