input: Write a python function to calculate the median of a list of numbers.
  assert median([1, 3, 3, 6, 7, 8, 9]) == 6
  assert median([1, 2, 3, 4, 5, 6, 8, 9]) == 4.5
  assert median([1, 2, 3]) == 2
output: def median(lst):
      sorted_lst = sorted(lst)
      n = len(sorted_lst)
      mid = n // 2
      if n % 2 == 0:
          return (sorted_lst[mid - 1] + sorted_lst[mid]) / 2
      else:
          return sorted_lst[mid]