import numbers


def get_avg_over_samples(sampleList, first=0, last=-1):
    """
    Returns the average of the list passed in. This is used to get a summary
    over a range in a list

    Args:
        sampleList (list): List of numeric samples to sum over

    Returns:
        The average over the requested range
    """
    assert isinstance(sampleList, list)
    assert len(sampleList) > 0
    assert isinstance(sampleList[0], numbers.Number)

    if (last == -1):
        last = len(sampleList)

    return sum(sampleList[first:last]) / (last - 1 - first)