Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Problem 4- Create a class Population with attributes: - pop(list[Person]) with methods: __init__(people) initialize the Population.pop attribute with people add_person(person) - a method that

Python Problem 4-

Create a class Population with attributes:

- pop(list[Person])

with methods:

__init__(people) initialize the Population.pop attribute with people

add_person(person) - a method that takes a Person and adds them to the population (updating the self.pop attribute)

add_people(people) - a method that takes a list of Person objects and adds them to the population (updating the self.pop attribute)

filter_population(m_or_f, height_min, height_max, weight_min, weight_max)- Where m_or_f is a string = ('male', 'female', 'both'). Each of the parameters should be used to filter the Population.pop down to the relevant Person objects, and return the resulting list of Persons

Population.filter_population(male, 48, 84, 100, 300) would get the Person objects with the following:

Person.sex = male

48 <= Person.height < = 84

100 <= Person.weight <= 300

Population.stats()- This method should return a dictionary containing the mean, median, and standard deviation for each distribution (Age, Height, Weight) for the entire population, females, and males.

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_2

Step: 3

blur-text-image_3

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

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions