Hi everyone. I need some help. I would like to only take items from this list, until the values have reached a sum of 20. How would I do that? It would also work if I could drop items after the sum of these values have reached 20. I’ve searched and didn’t find anything. In the example below, the last item I want to take is at index 10.
Check this out for recursive sum. It’s an old image so it’s a little hard to read, but you’re just getting an incrementally longer sublist to sum together.
Once you have your recursive sum you can check to see which values are <= 20 and mask the list.
1 Like