I have this list of integers that I want to split into groups of 4 elements by condition:
result = [0, 4, 10, 6, 15, 9, 18, 35, 40, -30, -90, 99]
The first item of each group should be greater than the fourth following item. Output should be like this:
[[10, 6, 15, 9], [18, 35, 40, -30], [35, 40, -30, -90]]
but how do I apply that conditions in this code?
split_no = 4
list(split_list(result, split_no))
Currently my output looks like this:
[[0, 4, 10, 6], [15, 9, 18, 35], [40, -30, -90, 99]]