input: 
  Write a function to calculate the mean and median of an array. The function should return both values as a tuple. If the array is empty, it should return (None, None). 
  
  assert mean_median([10, 15, 20, 25, 30, 35]) == (22.5, 22.5)
  assert mean_median([3, 8, 9, 1, 5, 7, 9, 5]) == (5.875, 6.0)
  assert mean_median([1, 2, 3, 4, 9]) == (3.8, 3)
  assert mean_median([]) == (None, None)
  
output:     
      if not numbers:
          return (None, None)
      
      sorted_numbers = sorted(numbers)
      length = len(sorted_numbers)
      
      mean = sum(sorted_numbers) / length
      
      if length % 2 == 0:
          median = (sorted_numbers[length // 2 - 1] + sorted_numbers[length // 2]) / 2
      else:
          median = sorted_numbers[length // 2]
      
      return (mean, median)
  