Hi, I’m stuck on the exercise “It’s Okay to be average”, could some one help me please?
Define a function called average that has one argument, numbers.
Inside that function, call the built-in sum() function with the numbers list as a parameter. Store the result in a variable called total.
Like the example above, use float() to convert total and store the result in total.
Divide total by the length of the numbers list. Use the built-in len() function to calculate that.
Return that result.
Error message I get:
average([3, 0]) returned 3.0 instead of 1.5 as expected.
def average(numbers): total = sum(numbers) total = float(total) total / len(numbers) return total