input: Write a function to calculate the minimum and maximum values in an array. The function should iterate through the array and update the minimum and maximum values accordingly. If the array is empty, it should return None for both the minimum and maximum values.
  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([])==(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