divide a list into three separate list
def divide_list(list1): list2 = [] list3 = [] list4 = [] for i in range(len(list1)): if i % 3 == 0: list2.append(list1[i]) elif i % 3 == 1: list3.append(list1[i]) else: list4.append(list1[i]) return list2, list3, list4 divide_list([1,2,3,4,5,6,7,8,9])