310 B
310 B
title, tags
| title | tags |
|---|---|
| unique_elements | list,beginner |
Returns the unique elements in a given list.
- Create a
setfrom the list to discard duplicated values, then return alistfrom it.
def unique_elements(li):
return list(set(li))
unique_elements([1, 2, 2, 3, 4, 3]) # [1, 2, 3, 4]