code: def median(values):
      
      n = len(values)
      values = sorted(values)
      if n % 2 == 1:
          return values[n/2]
      else:
          middle2 = values[(n/2)-1:(n/2)+1]
          try:
              return mean(middle2)
          except TypeError:
              return random.choice(middle2)
docs: Return the middle value, when the values are sorted.
      If there are an odd number of elements, try to average the middle two.
      If they can't be averaged (e.g. they are strings), choose one at random.
      >>> median([10, 100, 11])
      11
      >>> median([1, 2, 3, 4])
      2.5