Question: Write a function named avg that fulfills the following specification by replacing the pass line: def avg (numbers) : signature: list (float) -> float
Write a function named avg that fulfills the following specification by replacing the pass line:
def avg (numbers) : """
signature: list (float) -> float precondition: numbers != [] returns the average (mean) of a non-empty list of floats """ pass # TODO: implement the body of this function
You may assume that the input is not an empty list. That is, your code does not need to handle the situation when numbers is [].
Your function should not use print or input at all. Note: for the purposes of this problem, you may not use the built-in sum function, rather
you should write a loop that iterates over the items in the list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
