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 (only one parameter: person_list) 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).

Answers

Answer 1

Answer:

class Person(object):

   def __init__(self, name, age):

       self.name = name

       self.age = age

 

def std_dev(person_list):

   average = 0

   for person in person_list:

       average += person.age

   average /= len(person_list)

   total = 0

   for person in person_list:

       total += (person.age - average) ** 2

   return (total / (len(person_list) )) ** 0.5

Explanation:

The class "Person" is a python program class defined to hold data of a person (name and age). The std_dev function accepts a list of Person class instances as an argument and returns the calculated standard deviation of the population.


Related Questions

Gamification and virtual reality is the future of education

Answers

Answer:

Education is expected to be the fourth largest sector for VR investment. VR in education is predicted to be a $200 million industry by 2020, and a $700 million industry by 2025. 97% of students would like to study a VR course.

Explanation:

How to do brainliest

Answers

If the reply that someone put has a blue crown you click it and it will give them brainliest but it usually won’t work unless there are two answers

What email program would you suggest and why?

Answers

Answer:

An email program

Explanation:

And why?

Answer:

I would suggest g m a i l.

Explanation:

I use G m a i l all the time and I think it is easy to use! A lot of people think it is great too! :)

Identify the correct characteristics of Python lists. Check all that apply. Python lists are enclosed in curly braces { }. Python lists contain items separated by commas. Python lists are versatile Python data types. Python lists may use single quotes, double quotes, or no quotes.

Answers

Answer:

Python lists contain items separated by commas.

Python lists are versatile Python data types.

Python lists may uses single quotes, double quotes, or no quotes.

Explanation:

Python Lists are enclosed in regular brackets [ ], not curly brackets { }, so this is not a correct characteristic.

Answer:

a c d

Explanation:

Any1??
Write the names of atleast 22 high-level programming languages

Answers

Answer:

1 Array languages

2 Assembly languages

3 Authoring languages

4 Constraint programming languages

5 Command line interface languages

6 Compiled languages

7 Concurrent languages

8 Curly-bracket languages

9 Dataflow languages

10 Data-oriented languages

11 Decision table languages

12 Declarative languages

13 Embeddable languages

13.1 In source code

13.1.1 Server side

13.1.2 Client side

13.2 In object code

14 Educational languages

15 Esoteric languages

16 Extension languages

17 Fourth-generation languages

18 Functional languages

18.1 Pure

18.2 Impure

19 Hardware description languages

19.1 HDLs for analog circuit design

19.2 HDLs for digital circuit design

20 Imperative languages

21 Interactive mode languages

22 Interpreted languages

23 Iterative languages

Explanation:

Write a program that reads an integer between o and 1000 and adds all the digits in the integer. For example, if an integer is 932, the sum of all the digits is 14. Hint: Use the % operator to extract digits, and use the / operator to remove the extracted digit. For instance, 932 % 10=2 and 932/10 =93. Here is a sample run:
Enter a number between 0 and 1000 : 999
The sum of digits is 27.

Answers

Answer:

Answered below

Explanation:

#Program is written in Python programming language

digit = 0

sum = 0

num = int(input("Enter a number between 0 and 1000: ")

#Check that number is within the valid range

if num > 0 and num <= 1000:

while num != 0:

#Isolate each digit

digit = num % 10

sum = sum + digit

#Remove isolated digit from number

num = num/10

else:

print("Number is not within valid range")

#print total sum of digits

print(sum)

/* missing precondition */

public String getChar(String str, int n) {

return str.substring(n, n 1); }

Write down the most appropriate precondition for the method so that it does not throw an exception.

Answers

Answer:

An appropriate precondition is:

0 <= n && n <= str.length() - 1

Explanation:

Required:

Write down an appropriate pre-condition for the program

From the question, we understand that the method accepts two parameters:

str -> A string value

n -> An integer value which represents the index of character to return from the string str

It should be noted that:

n must be within the range of 0 and str.length()-1

Take for instance:

str = "ABCDE";

n must be within the range 0 to 4 (inclusive) in order not to raise an exception. This is so because the string index starts at 0 and stops at 1 less than the length of the string.

Hence, the precondition can be written as:

0 <= n && n <= str.length() - 1

Which means: n = 0 to length - 1

Other Questions
If an airplane in a 1 in. : 4 ft. scale drawing is 5 in. long, how long is the actual airplane? Use proportions to solve the problem and show all work. Provide a proper label with your answer. What technology is Indus valley known for? Which is the solution of this system of equations?y=5x-83y=x+18Answers:x=7, y=3 x=4, y=12x=3, y=7 x=0, y=6 solve the inequality -2z-3 Plz help find the area of the polygon 3. Conclude the impact the Germanic barbarians such as the Vandals, Angles, Saxons, Huns, and Visigoths had on the fall of Rome. Which expression is equivalent? what is the answer to 9p 6 = 141 What is the purpose or overall message of this image? HELP ASAP6+ x - y + 10= Which of the following was areason for many to settle out in the West under the Homestead Act?A. the frequent droughts in the New EnglandstatesB. the land was yours at no cost after five yearsC. the invention of the automobileD. the demand for wheat and corn to beproduced And this one please Why was Fort Sumters location important?A).It was near the capital of the Union.B).It blocked shipping lanes in the North.C).It served as the base of the Confederacy.D).It protected commercial areas in the South. Will mark brainliest!! Please do the two in green using cos!! Which sentence correctly uses the conditional mood?I would have told the truth if I'd known it.I would tell the truth if I will know it.I will tell the truth when I know it.I would tell the truth if I'd known it. Answer ASAP this practice is due tomorrow I will give brainiest to whoever answers correctly !! 3 3/5 x (-8 1/3) = Please help and quick Explain why Louie was described as untamable 0.03y=-0.01x+0.12HALPGRAPH PLEASE