On Tue, 11 Oct 2016 12:38 am, amornsak....@gmail.com wrote: > I have a list is > > land = [10,20,30,40,110,50,18,32,5] > > and I want to find each values of summation (don't sorted values in list) > as It has highest as possible > > example. > > I want to dividing N=3 part from list as above and divieded each part has > highest values that as possible. *** (don't sorted values in list) > > first part has values is = 10, 20, 30, 40 > summation = 10+20+30+40 = 100
Why do you add four numbers? Why not add all the numbers? 10+20+30+40+110+50+18+32+5 = 315 > second part has values is = 110 > summation = 110 Why do you only take one number? > and third part has values is = 50, 18, 32, 5 > summation = 105 Why do you take four numbers? > that 100, 110 and 105 is highest values as possible in list by dividing > N=3 part. I do not understand, what do you mean "dividing N=3 part"? Could you do this? [10,20,30,40,110,50,18,32,5] split into three lists: [10,20,30,40,110,50,18], [32], [5] Or these three lists: [10], [20,30,40,110,50,18], [32,5] Or these three lists: [10,20,30], [40,110,50], [18,32,5] How do you split the list into three? -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list