Given a list, write a function list_max_min(nums) that returns another list that contains repeated results of the additions of the smallest value to the biggest value. The elements of the new list need to sum up a close to 30 as possible without exceeding 30. Assume the list will be of length 2 or more.
- Make sure to deal with the correct sum of the new list
- Note: If the sum of the minimum and maximum value of a list is less or equal to 0, the function should return 0.
For example:
- If
numis[3, 4, 6, 5], the output is[5, 5, 5, 5, 5] - If
numis[2, 5, 4, 3], the output is[7, 7, 7, 7] - If
numis[0, 0, 0], the output is0