def gapBetweenRanges(rangeA,rangeB):
    """\
    Returns the gap between two ranges of values, or zero if there is no gap.
    The sign of the returned value indicates which range is below the other.
    
    For example:
    * The gap between (0,10) and (15,25) is -5
    * The gap between (0,10) and (9,20) is 0
    * The gap between (20,30) and (10,18) is 2
    
    :param rangeA: a tuple (lo,hi) representing a range of values.
    :param rangeB: a tuple (lo,hi) representing a range of values.
    
    :returns: zero if two ranges overlap; otherwise the gap separating them.
        If rangeA is below range B then the value will be negative.
        If rangeA is above range B then the value will be positive.
    """
    aLo,aHi = rangeA
    bLo,bHi = rangeB
    
    if aLo > bHi:
        return aLo-bHi
    elif aHi < bLo:
        return aHi-bLo
    else:
        return 0