python更新平均值

def addToAverage(average, size, value):
    '''
    The following function adds a number to an average. average is the current average,
    size is the current number of values in the average, and value is the number to add
    to the average:
    '''
    return ((size-1) * average + value) / (size)
原文地址:https://www.cnblogs.com/yibeimingyue/p/15236010.html