Hacker News new | ask | show | jobs
by janoulle 5580 days ago
I'm learning Python (3) w/ MIT OCW and here's my solution (http://pastebin.com/EQevWQWC). def dupefinder(lister): '''Function to find first duplicate in a list; Variable to pass to this function should be of type "list" ''' listerdupe = sorted(lister) for index,item in enumerate(listerdupe): if item == listerdupe[index+1]: print('First duplicate number is {0}'.format(item)) return item