Created
November 3, 2019 04:57
-
-
Save nhdinh/afa6b56e7c3d5d00e388582a6f0ef980 to your computer and use it in GitHub Desktop.
All unique
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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