Created
July 2, 2020 23:15
-
-
Save adambene/fecfa30e44f006c2d09ef2308a0acf34 to your computer and use it in GitHub Desktop.
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 distinct_preserve_order(items): | |
seen = set() | |
result = list() | |
for item in items: | |
if item not in seen: | |
seen.add(item) | |
result.append(item) | |
return list(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment