Average in VBA in Excel

Look closely at what you’re trying to do in this code: You’re assigning a “long” value to each of l and m and then calling them in the average function as if they were references to a cell. I suggest that you add a range variable, assign the location of the data you want to … Read more

Calculate average in java

Just some minor modification to your code will do (with some var renaming for clarity) : Note that the loop can also be simplified: Edit: the OP seems to want to use the args array. This seems to be a String array, thus updated the answer accordingly. Update: As zoxqoj correctly pointed out, integer/double overflow is not … Read more

Finding the average of a list

On Python 3.4+ you can use statistics.mean() On older versions of Python you can do On Python 2 you need to convert len to a float to get float division There is no need to use reduce. It is much slower and was removed in Python 3.