Re: Help me!, I would like to find split where the split sums are close to each other?

2016-10-16 Thread Michael Torrie
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


Re: Help me!, I would like to find split where the split sums are close to each other?

2016-10-16 Thread breamoreboy
On Sunday, October 16, 2016 at 12:27:00 PM UTC+1, k.ade...@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.
> 
> Thank you very much
> 
> K.ademarus

We do not write code for you.  I'd suggest you start here 
https://docs.python.org/3/library/itertools.html

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list