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 split(list, num_groups): return [list[x:x + num_groups] for x in range(0, len(list), num_groups)] split(['a', 'b', 'c', '1', '2', '3','4', '5', '6'], 3)

Questions about programming?Chat with your personal AI assistant