On 10/16/2016 05:25 AM, k.adema...@gmail.com wrote: > Help me!, I would like to find split where the split sums are close > to each other? > > I have a list is > > test = [10,20,30,40,50,60,70,80,90,100] > > and I would like to find split where the split sums are close to > each other by number of splits = 3 that all possible combinations > and select the split where the sum differences are smallest. > > Please example code or simple code Python.
Ahh, sounds like a homework problem, which we will not answer directly, if at all. If you had no computer at all, how would you do this by hand? Can you describe the process that would identify how to split the piles of candies, money, or whatever other representation you might use? So forgetting about Python and the specifics of making a valid program, how would you solve this problem? What steps would you take? This is known as an algorithm. Once you have that figured out, then you can begin to express the algorithm as a computer program. -- https://mail.python.org/mailman/listinfo/python-list