= Welcome to **Playground** project == Sample project flowtimer see source:flowtimer@master for the master branch see source:flowtimer@guix for the development branch {{{#!json { "phase_list": [ { "title": "Huddle", "duration": 10 }, { "title": "Tasking", "duration": 5 }, { "title": "Work", "duration": 45 }, { "title": "Break", "duration": 15 } ], "repetitions": 3 } }}} {{{#!python from Phase import Phase from RecurringPhaseSequence import RecurringPhaseSequence from Schedule import Schedule p1 = Phase('Huddle', 10) p2 = Phase('Tasking', 5) p3 = Phase('Work', 45) p4 = Phase('Break', 15) seq1 = RecurringPhaseSequence(phase_list = [p1, p2, p3, p4], repetitions=3) unrolled = [[deepcopy(seq) for seq in [each for each in seq1.repetitions * seq1.phase_list]]] schedule = Schedule(unrolled) }}} Certainly! Let's break down the task with an example: ### Given: - You have a list of lists. - You want to split each sublist at the point where the sublist starts with a given symbol. ### Example: #### Input: ```python list_of_lists = [ ['a', 1, 2, 3], ['b', 4, 5, 6], ['*', 7, 8, 9], ['c', 10, 11], ['*', 12, 13], ['d', 14, 15, 16] ] symbol = '*' ``` #### Expected Output: ```python [ [['a', 1, 2, 3], ['b', 4, 5, 6]], [['*', 7, 8, 9], ['c', 10, 11]], [['*', 12, 13], ['d', 14, 15, 16]] ] ``` ### Steps: 1. **Initialize an empty result list**: This will hold the final split sublists. 2. **Iterate through each sublist**: Check if the first element of the sublist is the given symbol. 3. **When the symbol is found**: Start a new group in the result list. 4. **Continue grouping until the symbol is encountered again**. ### Python Code Implementation: ```python def split_list_of_lists(list_of_lists, symbol): result = [] current_group = [] for sublist in list_of_lists: if sublist[0] == symbol and current_group: result.append(current_group) current_group = [] current_group.append(sublist) if current_group: result.append(current_group) return result # Example usage list_of_lists = [ ['a', 1, 2, 3], ['b', 4, 5, 6], ['*', 7, 8, 9], ['c', 10, 11], ['*', 12, 13], ['d', 14, 15, 16] ] symbol = '*' output = split_list_of_lists(list_of_lists, symbol) print(output) ``` ### Output: ```python [ [['a', 1, 2, 3], ['b', 4, 5, 6]], [['*', 7, 8, 9], ['c', 10, 11]], [['*', 12, 13], ['d', 14, 15, 16]] ] ``` This code takes a list of lists and splits it into separate groups whenever a sublist starts with the specified symbol. Each group is then added to the result. The result is a list of these grouped sublists.