input: Write a function to find the minimum and maximum values in a given array. If the array is empty, return None for both values.
  def min_max(array):
      if not array:
          return None, None
      min_val = array[0]
      max_val = array[0]
      for val in array[1:]:
          if val > max_val:
              max_val = val
          if val < min_val:
              min_val = val
      return min_val, max_val
  
  assert min_max([3, 5, 7, 2, 8])==(2, 8)
  assert min_max([1, 1, 1, 1, 1])==(1, 1)
  assert min_max([-10, 0, 10, 20])==(-10, 20)
  assert min_max([])==(None, None)
output: def min_max(array):
      if not array:
          return None, None
      min_val = array[0]
      max_val = array[0]
      for val in array[1:]:
          if val > max_val:
              max_val = val
          if val < min_val:
              min_val = val
      return min_val, max_val