Question: need it in python programming 2. Write a function called getAverage () that accepts a list of numbers and a second argument representing the quantity

 need it in python programming 2. Write a function called getAverage
need it in python programming

2. Write a function called getAverage () that accepts a list of numbers and a second argument representing the quantity of numbers to average. For example, getAverage (lst, 4) should return the average of the first 4 numbers in the list. Similarly, getAverage (1st3, 7) should return the average of the first 7 numbers in the list. HOWEVER, before calculating the average, you should first check to see if the list contains enough numbers In the previous example, , if 'list' only had 5 numbers in it, then it would be impossible to get the average of the first 7 numbers. In this case, the function should return the boolean value False. Here are some examples Isti = [3,4,8,3, 2] 1st2 = 12, 7, 9, 15, 21, 43, -6, -2, 38) print( getAverage (lsti, 3)) #should output the average of the first 3 numbers of Isti, 1.e.5 print(getAverage (ist2, 4)) #should output the average of the first 4 numbers of lat2, 1... 8.25 print(getAverage (1st2, 15)) #should output: False -- since lat2 does not have 15 numbers in it

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!