1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
r-ruslan [8.4K]
3 years ago
12

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).
Computers and Technology
1 answer:
umka21 [38]3 years ago
3 0

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.

You might be interested in
Write a function called average() that takes a single parameter, a list of numeric values. The function should return the averag
QveST [7]

Answer:

The following code is in python.

import statistics as st #importing statistics which include mean function.

def average(lst): #function average.

   return st.mean(lst)#returning mean.

lst=a = list(map(int,input("\nEnter the list : ").strip().split()))#taking input of the list..

print("The average is "+str(average(lst)))#printing the average.

Output:-

Enter the list :

1 2 3 4 5 6

The average is 3.5

Explanation:

I have used the statistics library which includes the mean function that calculates the mean or average of the list.In the function average having lst as an argument returns the mean of the list lst.

Then taking lst input from the user and printing it's average.

3 0
3 years ago
Gold is not more useful than iron. (Rewrite in positive form by replacing the comparative adjective)​
Sonja [21]

Answer:

Gold is more useful than iron

5 0
3 years ago
What is the output for the code below?
alisha [4.7K]
What is output by the code below? int[] array = {33,14,37,11,27,4,6,2,6,7}; System .out.println(array.length); ... int[] array = {5,10,3,6,9,15}; ... int total = 0; ... output by the code below? int j=1, tally=0; while(j<9) { tally++; j++; } System.out.print(tally);.
From quizlet
5 0
3 years ago
WILL GIVE BRAIINLIEST AND WATER ICE FROM RITA'S!!!!!!!!!
cricket20 [7]

Answer:

When you purchase a connecting flight, checked baggage is usually forwarded to your final destination, and will change planes when you do. ... In some cases if you purchased multiple tickets that are not all on the same carrier you may need to recheck your baggage

Explanation:

3 0
3 years ago
Over the last ten years, what has caused the audience ratio of three major networks, CBS, NBC, and ABC from 90 percent to 60 per
Goryan [66]
D is your answer good luck
5 0
4 years ago
Other questions:
  • Get user input as a boolean and store it in the variable tallEnough. Also, get user input as a boolean and store it in the varia
    8·1 answer
  • What's the difference between kilobyte and kibibyte, and why was the IEC convention for computer international memories made???
    9·1 answer
  • A user of the wireless network is unable to gain access to the network. The symptoms are:1.) Unable to connect to both internal
    6·1 answer
  • Who is responsible for keeping your facility in compliance? A) Technicians B) Supervisors C) Owners D) All of the above
    11·1 answer
  • What is the likely long-term consequence of an increase in the relative percent of greenhouse gases in Earth’s atmosphere?
    5·1 answer
  • XYZ Corp.’s facilities in Nashua, New Hampshire, are two office buildings 400 feet apart, each with its own LAN. To connect the
    9·1 answer
  • What are scientists going to explore next on Kepler-186f? A) evidence of the existence of life B) types of plant life that exist
    8·2 answers
  • Preciso de ajudar para resolver esse exercício, é para amanhã cedo!!<br><br> Em Dev C++
    12·2 answers
  • Golf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to ho
    5·1 answer
  • When we look for errors inside of our code on our own or with a partner , what is that called?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!