input: Write a function to calculate the mean and median of an input array. The function should return both values as a tuple. If the array is empty, return None for both mean and median.
  assert mean_median([10, 15, 20, 25, 30, 35])==(22.5, 22.5)
  assert mean_median([1, 3, 5, 7, 9])==(5.0, 5)
  assert mean_median([2, 4, 6, 8])==(5.0, 5.0)
  assert mean_median([])==(None, None)
output: def mean_median(arr):
      if not arr:
          return None, None
      mean_val = sum(arr) / len(arr)
      arr.sort()
      n = len(arr)
      if n % 2 == 0:
          median_val = (arr[n//2 - 1] + arr[n//2]) / 2
      else:
          median_val = arr[n//2]
      return mean_val, median_val