Remove duplicates · 중복 제거
Remove duplicates
Return a new list that keeps each value only once, in the order it first appeared: [1, 1, 2, 3, 3, 1] becomes [1, 2, 3].
A set answers "have I seen this already?" in one fast step. Keep a set of seen values and a list for the result, and only append a value the first time you meet it.
중복 제거
새로운 리스트를 반환하여 각 값이 처음(first) 등장한 순서대로 오직 한 번만 남게 합니다: [1, 1, 2, 3, 3, 1]은 [1, 2, 3]이 됩니다.
set은 "이것을 이미 봤는가?"라는 질문에 한 번의 빠른 단계로 답합니다. 보았던 값들의 집합(set)과 결과를 위한 목록을 유지하고, 값을 처음 만났을 때만 추가하십시오.
Write dedupe(xs) that returns a new list with duplicates removed, keeping the order of first appearance. · dedupe(xs)를 작성하여 중복을 제거한 새로운列表를 반환하십시오. 첫 번째 출현 순서는 유지하십시오.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.