Created
July 2, 2020 22:52
-
-
Save adambene/cd0d9f568e4ba797ce2de345f6284ba4 to your computer and use it in GitHub Desktop.
This file contains 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 distinct_set(items): | |
result = set() | |
for item in items: | |
# Checking is not needed, because the list.add() method is idempotent | |
result.add(item) | |
return list(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment