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, 7, 8, 9, 0, 1])

Questions about programming?Chat with your personal AI assistant