Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

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

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

1. Identify six different types of history.

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago

Question

Explain methods of metal extraction with examples.

Answered: 1 week ago