input: Write a function to calculate the mean and median of a given array. If the array is empty then return None for both mean and median.
  assert mean_median([10, 15, 20, 25, 30, 35])==(22.5, 22.5)
  assert mean_median([7, 3, 1, 5, 9])==(5, 5)
  assert mean_median([4, 8, 6, 2])==(5.0, 5.0)
  assert mean_median([11, 13, 15, 17, 19, 21])==(16.0, 16.0)
  assert mean_median([])==(None, None)
output: def mean_median(arr):
      if not arr:
          return None, None
      arr.sort()
      n = len(arr)
      mean = sum(arr) / n
      if n % 2 == 0:
          median = (arr[n//2 - 1] + arr[n//2]) / 2
      else:
          median = arr[n//2]
      return mean, median