input: Below is an instruction that describes a task. Write a response that appropriately completes the request.
  
  ### Instruction:
  Generate a function for calculating the median of a list of numbers in Python.
  
  ### Input:
  Not applicable
  
  ### Output:
  def med_list(lst):
      """
      Calculate the median of a list of numbers.
      >>> med_list([1, 2, 3, 4, 5])
      3
      >>> med_list([1, 3, 5, 7, 9, 11])
      6.0
      """
      sorted_lst = sorted(lst)
      length = len(sorted_lst)
      if length % 2 == 1:
          return sorted_lst[length // 2]
      else:
          mid1 = sorted_lst[length // 2 - 1]
          mid2 = sorted_lst[length // 2]
          return (mid1 + mid2) / 2
output:     sorted_lst = sorted(lst)
      length = len(sorted_lst)
      if length % 2 == 1:
          return sorted_lst[length // 2]
      else:
          mid1 = sorted_lst[length // 2 - 1]
          mid2 = sorted_lst[length // 2]
          return (mid1 + mid2) / 2