ol-rlo-zl
[프로그래머스 lv2] 튜플 - 파이썬(Python) 본문
문제
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
풀이
def solution(s):
res = []
s = s[2:-2].split('},{')
s.sort(key=len)
for i in s:
for j in i.split(','):
if int(j) not in res:
res.append(int(j))
return res
실행결과
'Programmers(Python)' 카테고리의 다른 글
[프로그래머스 lv2] k진수에서 소수 개수 구하기 - 파이썬(Python) (0) | 2023.03.27 |
---|---|
[프로그래머스 lv2] 전화번호 목록 - 파이썬(Python) (0) | 2023.03.27 |
[프로그래머스 lv2] 타겟 넘버 - 파이썬(Python) (0) | 2023.03.27 |
최대공약수(gcd)와 최소공배수(lcm) - 파이썬(Python) (0) | 2023.03.26 |
[프로그래머스 lv2] n^2 배열 자르기 - 파이썬(Python) (0) | 2023.03.22 |