Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions