Answered step by step
Verified Expert Solution
Question
1 Approved Answer
def find_lists_avg(list_of_lists): list_of_avgs = [] if len(list_of_lists) == 0: return None else: for l in list_of_lists: avg = float(sum(l))/len(l) list_of_avgs.append(avg) return list_of_avgs Write a function,
def find_lists_avg(list_of_lists): list_of_avgs = [] if len(list_of_lists) == 0: return None else: for l in list_of_lists: avg = float(sum(l))/len(l) list_of_avgs.append(avg)
return list_of_avgs
Write a function, find lists_avg(...), that computes the average of a list of numbers. The function accept one parameter, list_of_lists, from which you should extract each list and compute the average of the values in each list. You can assume that the values in the list are either integers or floats. The function should return a list of averages of the lists. Ex. list-of-lists [[1,2,3], [2,4], [3,3,3]] print(find_lists_avg(list_of_lists)) should output: [2.0, 3.0, 3.0]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