input: Write a function that calculates the minimum and maximum values in a given array. The function should return the minimum and maximum values as a tuple.
  
  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, 4, 1, 2, 5])==(1, 5)
  assert min_max([-1, 0, 1])==(-1, 1)
  assert min_max([2, 2, 2])==(2, 2)
  assert min_max([4])==(4, 4)
  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