Question: In python Problem 12 Suppose we have a text file, records.txt, of people's names and their weights. Each line of the fle contains one name

 In python Problem 12 Suppose we have a text file, records.txt,In python

Problem 12 Suppose we have a text file, records.txt, of people's names and their weights. Each line of the fle contains one name and one weight, separated by a single space. Here is a sample file: Jack 88 i11 180 Peter 96 enny 155 Write the definition of the function avg weight, which returns the average weight of the people included in the file. The function takes in a one character config parameter, calculating the average weights of people whose names begin with the letter specified in the config parameter If given the letter J, with the function call avg,weight('), the function would only compute the average weight people whose names began with the letter J-Jack, Jill, and Jenny, ignoring Peter's weight, in the sample file shown above. If given the star character however, with the function all includes the weight of every person in the file in the calculation. avg_weight,the function def avg weight(config: str) -> float

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!