Created
September 30, 2012 06:57
-
-
Save apackeer/3806099 to your computer and use it in GitHub Desktop.
Remove Duplicates from an array
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 remDuplicates(arr): | |
returnme = [] | |
for i in arr: | |
if not i in returnme: | |
returnme.append(i) | |
return returnme | |
# Example: | |
# remDuplicates(["test", "test1", "test2", "test", "test2"]) -> ["test", "test1", "test2"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also, could add it to a set and then back again...