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)