input: Write a function to calculate the minimum and maximum values in an array. If the array is empty, the function should return None for both the minimum and maximum values. If the array contains only one element, the function should return the same element for both the minimum and maximum values.
  assert min_max([1, 2, 3, 4, 5])==(1, 5)
  assert min_max([5, 3, 4, 1, 2])==(1, 5)
  assert min_max([-1, -2, -3, -2, -1])==(-3, -1)
  assert min_max([10])==(10, 10)
  assert min_max([])==(None, None)
output: def min_max(arr):
      if not arr:
          return None, None
      if len(arr) == 1:
          return arr[0], arr[0]
      return min(arr), max(arr)