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
Masteriza [31]
3 years ago
7

Write a function called st_dev. St_dev should have one #parameter, a filename. The file will contain one integer on #each line.

The function should return the population standard #deviation of those numbers.
Computers and Technology
1 answer:
kodGreya [7K]3 years ago
6 0

Answer:

  1. import statistics
  2. def st_dev(file_name):
  3.    with open(file_name) as file:
  4.        data = file.readlines()
  5.        numList = []
  6.        for x in data:
  7.            numList.append(int(x))
  8.        
  9.        return statistics.pstdev(numList)
  10. print(st_dev("text1.txt"))

Explanation:

The solution code is written using Python.

To ease the calculation task, we can import Python statistics module to use the pstdev method to calculate the population standard deviation of a list of numbers (Line 1).

Next, create a st_dev function that take single argument file_name (Line 3). In the function, it will open the input file and read the data line by line (Line 4-5). Create a for loop to traverse through each line of the data which is an integer and append it to numList (Line 7-8). We can pass the numList to pstdev method (Line 10) and return the resulting standard deviation value as output.

We test the function by passing a file which hold a list of integer values in each line (Line 12).

8

9

12

11

21

15

16

10

7

13

And the output we shall get is 4.019950248448356

You might be interested in
Thinking actively promotes critical thinking. Explain how thinking actively promotes critical thinking
pav-90 [236]

A critical thinker is someone who is actively engaged in a thought process. Active thinking is that process of making judgments about what has happened while critical thinking involves a wide range of thinking skills that eventually leads to a desired outcome. Active thinking prompts learning during complex problems situations and provides learners with an opportunity to think about how a problem will be solved. As a result, it will help them evaluate, analyze, and intercept information.

8 0
3 years ago
While many instruments have been "electrified", there is no such thing for the drums.
coldgirl [10]
False, because they are called percussion group
4 0
3 years ago
Read 2 more answers
Programs which were typically reserved for college-level classes such as computer animation and CAD programs are now being appli
Irina-Kira [14]
Answer: I think C


Step by step explanation:
8 0
3 years ago
Which JavaScript defense restricts a JavaScript downloaded from Site A from accessing data that came from Site B?
suter [353]

Java script same origin defense restricts a JavaScript downloaded from Site A from accessing data that came from Site B.

<h3>Defenses and Browser Vulnerabilities</h3>

Java script sandboxing defense JavaScript to run in a restricted environment ("sandbox") and limit the computer resources it can access or actions it can take.

Java script same origin defense restricts a JavaScript downloaded from Site A from accessing data that came from Site B.

Java script limit capabilities restrict JavaScript to not support certain capabilities.

Find out more on browser vulnerability at: brainly.com/question/18088367

5 0
2 years ago
Give three reasons why it is important to have hci-based software programs.<br><br> need this soon
snow_lady [41]

The three reasons why it is important to have HCI-based software programs As a result, having a person with HCI capabilities concerned in all levels of any product or machine improvement is vital.

<h3>What is HCI and why is it important?</h3>

The Role of Human Computer Interaction withinside the Workplace. Human Computer Interaction (HCI) and User Experience (UX) are interdisciplinary fields that draw on human-focused disciplines like psychology and sociology to layout and increase technological merchandise that meet human needs.

As its call implies, HCI includes 3 parts: the user, the pc itself, and the methods they paint together.HCI is vital on account that it'll be important for items to be extra successful, safe, helpful, and functional. It will make the users revel in extra fun withinside the lengthy term. As a result, having a person with HCI capabilities concerned in all levels of any product or machine improvement is vital.

Read more about the software programs:

brainly.com/question/1538272

#SPJ1

8 0
2 years ago
Other questions:
  • Write a paragraph on the orgin or development of ONE of the following elementss of the Internet:
    15·1 answer
  • Match the following tasks with their appropriate timing.
    8·1 answer
  • (TCO 4) What will be the value of input_value if the value 5 is input at run time? cin &gt;&gt; input_value; if (input_value &gt
    12·1 answer
  • Which are among the ways you can use bitlocker encryption? (choose all that apply?
    5·1 answer
  • Web analytical packages can obtain the following information when someone visits a website, except Group of answer choices name
    9·1 answer
  • Iciples UI
    12·1 answer
  • Question 6 Which of the following statements about datasets used in Machine Learning is NOT true? 1 point Testing data is data t
    8·1 answer
  • When someone asks, Is this information specific enough?, he or she is interested in more _____.
    12·2 answers
  • A line graph is a great tool for showing changes over time. Why is a line graph better than other graphs at showing this type of
    6·1 answer
  • How do you create a function in C++
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!