Skip to content

Instantly share code, notes, and snippets.

@mahmoudhossam
Created November 6, 2011 09:19
Show Gist options
  • Save mahmoudhossam/1342675 to your computer and use it in GitHub Desktop.
Save mahmoudhossam/1342675 to your computer and use it in GitHub Desktop.
A function that returns duplicates in a list of integers
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