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 dividelist(lst): list1 = [] list2 = [] list3 = [] for i in range(0, len(lst), 3): list1.append(lst[i]) list2.append(lst[i+1]) list3.append(lst[i+2]) return list1, list2, list3 dividelist(['a', 'b', 'c', '1', '2', '3','4', '5', '6'])

Questions about programming?Chat with your personal AI assistant