(xs, sort=True)
Returns the median of an unsorted or sorted numeric vector.

    @param xs: the vector itself.
    @param sort: whether to sort the vector. If you know that the vector is
      sorted already, pass C{False} here.
    @return: the median, which will always be a float, even if the vector
      contained integers originally.
Returns the median of an unsorted or sorted numeric vector.
Returns the median of an unsorted or sorted numeric vector .
def median(xs, sort=True):
    """Returns the median of an unsorted or sorted numeric vector.

    @param xs: the vector itself.
    @param sort: whether to sort the vector. If you know that the vector is
      sorted already, pass C{False} here.
    @return: the median, which will always be a float, even if the vector
      contained integers originally.
    """
    if sort:
        xs = sorted(xs)

    mid = int(len(xs) / 2)
    if 2 * mid == len(xs):
        return float(xs[mid - 1] + xs[mid]) / 2
    else:
        return float(xs[mid])
def median ( xs , sort = True ) : if sort : xs = sorted ( xs ) mid = int ( len ( xs ) / 2 ) if 2 * mid == len ( xs ) : return float ( xs [ mid - 1 ] + xs [ mid ] ) / 2 else : return float ( xs [ mid ] )