input: Write a function to calculate and return the mean and median of a given array. First, compute the sum of the array elements, then divide the sum by the number of elements to get the mean. Sort the array and determine the median based on whether the length of the array is odd or even. If the length is odd, the median is the middle element, otherwise, it is the average of the two middle elements. If the array is empty, both the mean and median should be 0.  
  assert mean_median([10, 15, 20, 25, 30, 35])==(22.5, 22.5)  
  assert mean_median([3, 6, 7, 8, 8, 10, 13, 15, 16, 20])==(10.6, 9.0)  
  assert mean_median([1, 1, 3, 4])==(2.25, 2.0)  
  assert mean_median([7, 8, 9])==(8.0, 8.0)  
  assert mean_median([])==(0, 0)
output: def mean_median(arr):
      if not arr:
          return 0, 0
      mean = sum(arr) / len(arr)
      arr.sort()
      n = len(arr)
      if n % 2 == 1:
          median = arr[n // 2]
      else:
          median = (arr[n // 2 - 1] + arr[n // 2]) / 2
      return mean, median