Skip to content

Instantly share code, notes, and snippets.

@nhdinh
Created November 3, 2019 04:57
Show Gist options
  • Save nhdinh/afa6b56e7c3d5d00e388582a6f0ef980 to your computer and use it in GitHub Desktop.
Save nhdinh/afa6b56e7c3d5d00e388582a6f0ef980 to your computer and use it in GitHub Desktop.
All unique
def all_unique(list):
return len(list) == len(set(list))
x = [1,2,3,4,5,6,7,8,9,10]
y = [1,1,2,3,4,5,6,6,7,8,9]
all_unique(x) # True
all_unique(y) # False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment