cs102 lab3


http://www.maths.nuigalway.ie/~gettrick/teach/cs102/labs/2020labs/l3.html




This lab is based on the same idea as lab 1: We have a list of integers, representing the yearly profit (in kilo euro) of n businesses (shops) along the high street in the City centre. This time we are being given 4 (four) businesses ("for free"), that neighbor one another. The problem is to calculate which 4 we should take to maximize our yearly profit.
Given these numbers, write a PYTHON program to calculate which 4 we should take. As examples:

  1. If the profits were 52, 67, -8, 43, -20 we should take the first 4 businesses.
  2. If the profits were -20, 36, -10, -30, 3, 21 we would take no business (this is also allowed).
Run your program on the two lists at http://www.maths.nuigalway.ie/~gettrick/teach/cs102/labs/shops.txt and submit your answers with your program

© NUI, Galway