Cody Bable

Generation

generate functionThu, 13 Apr 2023

divide list ['a', 'b', 'c', '1', '2', '3'] into three separate list

def divide(list): list1 = [list[i] for i in range(0, len(list), 3)] list2 = [list[i] for i in range(1, len(list), 3)] list3 = [list[i] for i in range(2, len(list), 3)] return list1, list2, list3

Questions about programming?Chat with your personal AI assistant