Cody Bable

Generation

generate functionThu, 13 Apr 2023

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

def divide_list(list, num_divide): return [list[index::num_divide] for index in range(num_divide)] divide_list(['a', 'b', 'c', '1', '2', '3'], 3)

Questions about programming?Chat with your personal AI assistant