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(l, n): return [l[i:i + n] for i in range(0, len(l), n)] divide(['a', 'b', 'c', '1', '2', '3','4', '5', '6'], 3)

Questions about programming?Chat with your personal AI assistant