Skip to content

Instantly share code, notes, and snippets.

@henrikh
Forked from henrikh/gist:172977
Created August 22, 2009 20:45
Show Gist options
  • Save henrikh/172980 to your computer and use it in GitHub Desktop.
Save henrikh/172980 to your computer and use it in GitHub Desktop.
function average(){
numbers=average.arguments;
sum=0;
for(var i=0; i<numbers.length; i++){
sum+=numbers[i]
};
return sum/numbers.length;
}
(defun average (&rest numbers)
(/ (apply #'+ numbers)(length numbers)))
def average(*numbers):
return float(sum(numbers))/len(numbers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment