Cody Bable

Generation

generate functionThu, 06 Jul 2023

find the next duplicate in the list

def next_duplicate(l): for i in range(len(l)): for j in range(i+1, len(l)): if l[i] == l[j]: return l[i] return None next_duplicate([1, 2, 3, 4, 5, 6, 2])

Questions about programming?Chat with your personal AI assistant