Update syntax highlighting, update allUnique
This commit is contained in:
@ -6,12 +6,12 @@ Checks a flat list for duplicate values. Returns True if duplicate values exist
|
||||
|
||||
This function compares the length of the list with length of the set() of the list. set() removes duplicate values from the list.
|
||||
|
||||
``` python
|
||||
```py
|
||||
def has_duplicates(lst):
|
||||
return len(lst) != len(set(lst))
|
||||
```
|
||||
|
||||
``` python
|
||||
```py
|
||||
x = [1,2,3,4,5,5]
|
||||
y = [1,2,3,4,5]
|
||||
has_duplicates(x) # True
|
||||
|
||||
Reference in New Issue
Block a user