Question: Create code in python 3. Please note the use of: 1. TWO PRIVATE DATA members - the persons name and age. 2. Use of the

Create code in python 3. Please note the use of: 1. TWO PRIVATE DATA members - the persons name and age. 2. Use of the get_age method. 3. Create a separate function (not part of the Person class) called std_dev that takes as a parameter a list of Person objects and returns the standard deviation of all their ages. 4. Do not use the specific sqrt() function, that involves importing a module

See Screen Shot for assignment details. Create code in python 3. Please note the use of: 1. TWO

Write a class called Person that has two private data members - the person's name and age. It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Write a separate function (not part of the Person class) called std_dev that takes as a parameter a list of Person objects and returns the standard deviation of all their ages (the population standard deviation that uses a denominator of N, not the sample standard deviation, which uses a different denominator). To calculate the standard deviation, you'll need to take a square root, which you can do by just using an exponent of 0.5. For example, the result of 9 ** 0.5 would be 3.0. Python does have a specific sqrt() function, but that involves importing a module, which we haven't covered yet. Here's a simple example of how your class and function could be used: p1 = Person("Kyoungmin", 73) P2 = Person ("Mercedes", 24) p3 = Person ("Beatrice", 48) person_list = [p1, P2, P3] answer = std_dev (person_list) The file must be named: std_dev.py

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!