Question: Dafine a class named Person that has two private data members - the person's name and age - If should have an initializer method that

Dafine a class named Person that has two private data members - the person's name and age- If should have an initializer method that takes two values and uses them to initialize the data members. It should have a get age method that takes no parameters and returns the age.
Define a separate, top-level function (not part of the Person class) called std_dev that takes as a parameterallst of Person objects and returns the standard deviation of all their ages (the population standard deviation that uses adenominator of N , not the sample standard deviation, which uses a different denominator). Here's an example of celculating the population standard deviation.
If the listis empty, then the function std_dev function should return None.
Tocalculate the standard deviation, you'll need to take a square root, which you can do by just using an exponent of 0.5. For exemple, the result of 9**0.5 would be 3.0. Python does have a specific sqrt function, but that involvesimporting a module, which we haven't covered yet.
Heresasimple example of how your class and function could be used:
D1= Person(isyoungmin,73)
p2= Person (4Mercedes24)
p3=Person(4Beatrice, 48)
person 145t=[01,02,03]
answer = stodev(person115t)??#20.00555
Dafine a class named Person that has two private

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 Programming Questions!