Question: Write a function that takes as input a single parameter storing a list of integers and returns the average of the negative numbers in the

 Write a function that takes as input a single parameter storinga list of integers and returns the average of the negative numbers

Write a function that takes as input a single parameter storing a list of integers and returns the average of the negative numbers in the list as a floating point value. The average is calculated by finding the sum of all negative integers in the list divided by the number of negative numbers. Note O is not negative. For example, if the input is the list [1,2,-12,3] then your function should return the float -12 Since the average is -12/1 (as there is only 1 negative number) Or if the input is the list [4,5,6,7,8,9] Then your function should return the float 0 Since there are no negative numbers. Or if the input is the list (-4,-5, -6,7,-8,-9] Then your function should return the float -6.4 since the average is: (-4+-5+-6 +-8 +-9)/5. 1 def get_average(int_list): 2 # your code goes here 3 4 return 5 5 6 if __name '__main_': 7 # you can use this to test your code 8 print(get_average([0,3,-1,10])) 9

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!