input: Write a function to calculate the mean and median of a given array. If the array is empty, return (0, 0).
  
  def mean_median(arr):
      if len(arr) == 0:
          return 0, 0
      
      arr_sum = 0
      for num in arr:
          arr_sum += num
      
      mean = arr_sum / len(arr)
      
      arr = sorted(arr)
      if len(arr) % 2 != 0:
          median = arr[len(arr) // 2]
      else:
          median = (arr[len(arr) // 2] + arr[len(arr) // 2 - 1]) / 2
      
      return mean, median
  
  assert mean_median([10, 15, 20, 25, 30, 35]) == (22.5, 22.5)
  assert mean_median([3, 5, 7, 12, 13, 14, 21, 23, 23, 23, 23, 29, 40, 56]) == (22.785714285714285, 22)
  assert mean_median([]) == (0, 0)
  assert mean_median([1]) == (1.0, 1)
output: def mean_median(arr):
      if len(arr) == 0:
          return 0, 0
      
      arr_sum = 0
      for num in arr:
          arr_sum += num
      
      mean = arr_sum / len(arr)
      
      arr = sorted(arr)
      if len(arr) % 2 != 0:
          median = arr[len(arr) // 2]
      else:
          median = (arr[len(arr) // 2] + arr[len(arr) // 2 - 1]) / 2
      
      return mean, median