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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started