Skip to content

Latest commit

 

History

History
14 lines (7 loc) · 676 Bytes

File metadata and controls

14 lines (7 loc) · 676 Bytes

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 num is [3, 4, 6, 5], the output is [5, 5, 5, 5, 5]
  • If num is [2, 5, 4, 3], the output is [7, 7, 7, 7]
  • If num is [0, 0, 0], the output is 0