janoulle

#hackerunderground puzzle

Mar 4th, 2011
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. def dupefinder(lister):
  2.     '''Function to find first duplicate in a list; Variable to pass
  3.     to this function should be of type "list" '''
  4.     listerdupe = sorted(lister)
  5.     for index,item in enumerate(listerdupe):
  6.         if item == listerdupe[index+1]:
  7.             print('First duplicate number is {0}'.format(item))
  8.             return item
Add Comment
Please, Sign In to add comment