4 ms·
I'm learning Python (3) w/ MIT OCW and here's my solution (http://pastebin.com/EQevWQWC http://pastebin.com/EQevWQWC). def dupefinder(lister): '''Function
by janoulle 16y ago
I'm learning Python (3) w/ MIT OCW and here's my solution (http://pastebin.com/EQevWQWC 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
- deleted 16y ago[deleted]