Prepare repository for merge

This commit is contained in:
Angelos Chalaris
2023-05-01 22:43:50 +03:00
parent ab1ea476c5
commit a5ca5190e5
169 changed files with 0 additions and 626 deletions

View File

@ -0,0 +1,20 @@
---
title: Unique elements in list
type: snippet
tags: [list]
cover: cold-mountains
dateModified: 2020-09-15T16:13:06+03:00
---
Returns the unique elements in a given list.
- Create a `set` from the list to discard duplicated values, then return a `list` from it.
```py
def unique_elements(li):
return list(set(li))
```
```py
unique_elements([1, 2, 2, 3, 4, 3]) # [1, 2, 3, 4]
```