input: Write a function to calculate the minimum and maximum values in an array and return them as a tuple. 
  
  def min_max(array):
      if not array:
          return None, None
      min = array[0]
      max = array[0]
      for val in array[1:]:
          if val > max:
              max = val
          if val < min:
              min = val
      return min, max
  
  assert min_max([3, 4, 5, 1, 2])==(1, 5)
  assert min_max([3, 5, 10, 1, 2])==(1, 10)
  assert min_max([4, 3, 1, 2])==(1, 4)
  assert min_max([3, 5, 4, 1, 2])==(1, 5)
  assert min_max([])==(None, None)
output: def min_max(array):
      if not array:
          return None, None
      min = array[0]
      max = array[0]
      for val in array[1:]:
          if val > max:
              max = val
          if val < min:
              min = val
      return min, max