Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

project-6c Write a class called Person that has two data members - the person's name and age. It should have an init method that takes

project-6c

Write a class called Person that has two 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.

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

please code in python

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 Systems For Advanced Applications 17th International Conference Dasfaa 2012 Busan South Korea April 2012 Proceedings Part 1 Lncs 7238

Authors: Sang-goo Lee ,Zhiyong Peng ,Xiaofang Zhou ,Yang-Sae Moon ,Rainer Unland ,Jaesoo Yoo

2012 Edition

364229037X, 978-3642290374

More Books

Students also viewed these Databases questions