Cody Bable

Generation

generate functionThu, 06 Jul 2023

remove duplicates from a list

def remove_duplicates(my_list): new_list = [] for item in my_list: if item not in new_list: new_list.append(item) return new_list remove_duplicates([1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9])

Questions about programming?Chat with your personal AI assistant