This is an add-on of my previous question. The question I am trying to answer is:
I have a list of integers, representing the yearly profit (in kilo euro) of n businesses (shops) along the high street in the City centre. I am given 4 (four) businesses ("for free"), that neighbor one another. The problem is to calculate which 4 I should take to maximize my yearly profit. Given these numbers, write a PYTHON program to calculate which 4 I should take. As examples: If the profits were 52, 67, -8, 43, -20 I should take the first 4 businesses. If the profits were -20, 36, -10, -30, 3, 21 I would take no business.
Second attempt:
groups = zip(mylist,mylist[1:25,34,-2,-57],mylist[2:-8,47,28,19],mylist[3:47,-57,54,-96],mylist[4:-1,73,38,39],mylist[5:76,-49,6,-3],mylist[6:9,-7,-99,28],mylist[7:37,88,74,-3],mylist[8:23,-2,-5,78],mylist[9:38,-9,31,32],mylist[10:32,-58,66]
Answer = max(sum(groups))
It then tells me that "Answer" is invalid syntax. I dont know how to finish it off please help?