input: Write a function to calculate the minimum and maximum values in an array. The function should return the minimum and maximum values as a tuple. If the array is empty, the function should return None.
  def min_max(array):
      if not array:
          return 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([10, 2, 8, 3, 7])==(2, 10)
  assert min_max([4])==(4, 4)
  assert min_max([-1, -3, -2, -4])==(-4, -1)
  assert min_max([])==None
output: def min_max(array):
      if not array:
          return 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