Cody Bable

Generation

generate functionThu, 13 Apr 2023

divide a list into three separate list

def divide_list(a_list): third = len(a_list) // 3 return a_list[:third], a_list[third:2 * third], a_list[2 * third:] divide_list([1, 2, 3, 4, 5, 6, 7, 8, 9])

Questions about programming?Chat with your personal AI assistant