Created
November 6, 2011 09:19
-
-
Save mahmoudhossam/1342675 to your computer and use it in GitHub Desktop.
A function that returns duplicates in a list of integers
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 find_dups(l): | |
orig = [] | |
dups = [] | |
for i in l: | |
if i in orig: | |
dups.append(i) | |
else: | |
orig.append(i) | |
return dups |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment