input: Write a python function to calculate the median of a list of numbers.
  assert calculate_median([3, 5, 10, 2]) == 4.0
  assert calculate_median([7, 1, 3, 4, 6, 2, 5]) == 4
  assert calculate_median([10, 20, 30, 40]) == 25.0
output: def calculate_median(numbers):
      numbers.sort()
      n = len(numbers)
      mid = n // 2
      if n % 2 == 0:
          return (numbers[mid - 1] + numbers[mid]) / 2
      else:
          return numbers[mid]