Question: def sum_gt_avg(num_list): Implement a function that returns the sum of the numbers in num_list that have a value greater than the average value in the

 def sum_gt_avg(num_list): Implement a function that returns the sum of the
numbers in num_list that have a value greater than the average value
in the list. Parameters: num_list is a list of numbers (mixed integers

def sum_gt_avg(num_list): Implement a function that returns the sum of the numbers in num_list that have a value greater than the average value in the list. Parameters: num_list is a list of numbers (mixed integers and floats) Examples: sum_gt_avg([1,2,3,4,5]) 9 # 4+5 sum_gt_avg([1,2,3,-4,51) 10 # 2+3+5 sum_gt_avg([-1, -2, -3, -4,-5]) -3 # -1-2 15 edef sum gt avg (num list): 16 sum total = 0 17 for num in num list: 18 sum total += num 19 avg = sum total / len (num list) 20 sum_target = 0 21 for num in num list: 22 if num > avg: 23 sum_target += num 24 return sum_target 25. avg = sum_total / len(num_list) ZeroDivisionError: division by zero Ran 40 tests in 0.006s FAILED (errors=1) 39/40 Required test cases passed (worth 2.5 each) Score based on test cases: 97.50/100 (39.00*2.5)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!