Head vs breakz

[code] - 카카오 튜플 python 본문

Head/Code

[code] - 카카오 튜플 python

headbreakz 2020. 5. 5. 10:20
#튜플

def solution(s):
    b = []
    a = list(s[2:-2].split("},{"))
    a.sort(key = len)
    for i in range(len(a)):
        c=list(a[i].split(","))
        for j in range(len(c)):            
            if c[j] not in b  :
                b.append(c[j])
            
    for q in range(len(b)):
        b[q] = int(b[q])
    
    answer = b
    return answer

문자열을 쪼개고, 

다시 리스트로 쪼개고,

문자가 없으면 넣어주고

문자를 숫자로 변환

'Head > Code' 카테고리의 다른 글

[CODE] - ImageDataGenerator  (0) 2020.07.15
[code] - 카카오 압축 python  (0) 2020.05.07
[code] - 카카오 n진수 게임 python  (0) 2020.05.04
[code] - 카카오 괄호변환 python  (0) 2020.05.04
[code] - 카카오 호텔 방 배정 python  (0) 2020.05.02
Comments