Cody Bable

Generation

generate functionThu, 13 Apr 2023

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

def divide_list(list, n): return [ list[i::n] for i in range(n)] divide_list(['a', 'b', 'c', '1', '2', '3','4', '5', '6'],3)

Questions about programming?Chat with your personal AI assistant