| about | help | code help+videos | done | prefs |
Write a function named average that accepts a list of integers as its parameter and returns the average (arithmetic mean) of all elements in the list as a float. For example, if the list passed contains the values [1, -2, 4, -4, 9, -6, 16, -8, 25, -10], the calculated average should be 2.5. You may assume that the list contains at least one element. Your function should not modify the elements of the list. average([12, 7, -1, 25, 5, 9]) → 9.5 average([12, 7, -1, 25, 2, 39]) → 14.0 average([1, 2, 3]) → 2.0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290 Post-solution available
Copyright Nick Parlante 2017 - privacy