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
MrRa [10]
3 years ago
10

For this problem, you will write a function standard_deviation that takes a list whose elements are numbers (they may be floats

or ints), and returns their standard deviation, a single number. You may call the variance method defined above (which makes this problem easy), and you may use sqrt from the math library, which we have already imported for you. Passing an empty list to standard_deviation should result in a ZeroDivisionError exception being raised, although you should not have to explicitly raise it yourself.
Computers and Technology
1 answer:
Evgesh-ka [11]3 years ago
3 0

Answer:

  1. import math  
  2. def standard_deviation(aList):
  3.    sum = 0
  4.    for x in aList:
  5.        sum += x  
  6.    
  7.    mean = sum / float(len(aList))
  8.    sumDe = 0
  9.    for x in aList:
  10.        sumDe += (x - mean) * (x - mean)
  11.    
  12.    variance = sumDe / float(len(aList))
  13.    SD = math.sqrt(variance)
  14.    return SD  
  15. print(standard_deviation([3,6, 7, 9, 12, 17]))

Explanation:

The solution code is written in Python 3.

Firstly, we need to import math module (Line 1).

Next, create a function standard_deviation that takes one input parameter, which is a list (Line 3). In the function, calculate the mean for the value in the input list (Line 4-8). Next, use the mean to calculate the variance (Line 10-15). Next, use sqrt method from math module to get the square root of variance and this will result in standard deviation (Line 16). At last, return the standard deviation (Line 18).

We can test the function using a sample list (Line 20) and we shall get 4.509249752822894

If we pass an empty list, a ZeroDivisionError exception will be raised.

You might be interested in
The traditional role of a manager is that of a(n):__________ a. encoder. b. sensegiver. c. communication champion. d. informatio
GREYUIT [131]

The traditional role of a manager is that of a(n):<u> information processor.</u>

<u></u>

<h3>What is called as information processing?</h3>

information processing , the acquisition, recording, organization, retrieval, display, and dissemination of information. In recent years, the term has often been applied to computer-based operations specifically. information processing.

<h3>What is information processing in computer?</h3>

Information processing refers to the manipulation of digitized information by computers and other digital electronic equipment, known collectively as information technology (IT). Information processing systems include business software, operating systems, computers, networks and mainframes.

To learn more about Information processing , refer

brainly.com/question/6392847

#SPJ4

7 0
2 years ago
A program is run line by line to determine the source of a logic error. Which best describes the specific tool being used?
riadik2000 [5.3K]

Answer:

c

Explanation:

3 0
3 years ago
Read 2 more answers
When a Select Case statement executes, the value of the test expression is compared with the values that follow each of the ____
goldenfox [79]

Answer:

Case

Explanation:

In Computer programming, a variable can be defined as a placeholder or container for holding a piece of information that can be modified or edited.

Basically, variable stores information which is passed from the location of the method call directly to the method that is called by the program.

For example, they can serve as a model for a function; when used as an input, such as for passing a value to a function and when used as an output, such as for retrieving a value from the same function. Therefore, when you create variables in a function, you can can set the values for their parameters.

A Select Case statement can be defined as a conditional statement that avails software developers or programmers the ability to test a variable by comparing it with a list of values.

In a Select Case statement, each variable is referred to as a Case.

Generally, when a Select Case statement executes, the value of the test expression is compared with the values that follow each of the Case keywords.

7 0
3 years ago
a. Your program generates a random number between 0 and 128 and keeps asking the user to guess the number until the user guesses
geniusboy [140]

Answer:

import random

arr=[]

frr=open("score.txt","w")

for i in range(128):

   arr.append(i)

def func1(lst):

   score=0

   name=input("enter your name: ")

   while True:

       answer=random.choice(arr)  

       guess=int(input("enter your guess number between 0-128: "))

       if answer is guess:

           print("right guess\ncongratulations.....")

           print("the answer was: "+str(answer))

           score+=1

           break

       elif guess < answer-20:

           print("you guessed too low....\ntry again")

           print("the answer was: "+str(answer))

       elif guess > answer+20:

           print("you guessed too high....\ntry again")

           print("the answer was: "+str(answer))

       else:

           print("incorrect guess\ntry again")

           print("the answer was: "+str(answer))

       ext=int(input("press 0 to exit:\npress 1 to continue: "))

       if ext is 0:

           break

       

   return "{} {}".format(name,score)

num=int(input("how many users will be taking part: "))

for i in range(num):

   frr.write("{}\n".format(func1(arr)))

frr.close()

frr1=open("score.txt","r")

line=frr1.readline()

while line:

   print(line)

   line=frr1.readline()          

frr1.close()    

Explanation:

this code is in python3 language

it is displaying the name and the score, you just need to adjust the top 3 scores and least 3 scores.

3 0
4 years ago
What is Logic and Emotion?
m_a_m_a [10]
Logic is Strict principles of validity (reasoning)

Emotion is the natrual instinctive feeling from reasoning or knowledge.

Hope this helps! ^0^ <span />
8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the portion of the PowerPoint window that contains the current slide, total slides, zoom options, and various shortcuts
    8·1 answer
  • Why would you activate more than one nic on a pc?
    7·1 answer
  • 16235 to the nearest ten thousand
    13·2 answers
  • Alisa Miller claims that today's college graduates:
    7·1 answer
  • What type of link is used to call this file shown below?
    5·1 answer
  • Question 6 (2 points)
    11·1 answer
  • How many occupational groups are there in the SOC system?
    12·1 answer
  • Which of the following is defined in terms of their activities related to denial-of-service attacks? Cracker Script kiddie White
    6·1 answer
  • Answer the following questions which are based on the study "Patients' Engagement with Sweet Talk." Submit your answers.
    8·1 answer
  • What is the output for the following program?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!