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]
4 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]4 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
Mrs. Jackson wrote a newsletter to the customers of her housecleaning business that included some organizational tips they could
nika2105 [10]
The correct answer is a. effective communication

- - -
Ineffective and barriers to communication are problems that make communication unclear. Workplace communication is at work or at a job. This is not a job newsletter for workers, but for people at home.
5 0
4 years ago
Read 2 more answers
For the following graph, what is the goal state? A. state = GOAL B. state = E C. state= D D. cost >= 6
ser-zykov [4K]

Answer:

i think it A but idk but in my opinion i think it is A hope you get it correct

Explanation:

8 0
3 years ago
Name two word processor<br><br>​
Irina18 [472]

Answer:

the bat hunter

Explanation:

3 0
4 years ago
Write a function named enterNewPassword. This function takes no parameters. It prompts the user to enter a password until the en
Mkey [24]
______________———-___________
7 0
4 years ago
With the evolution of RFID instead of UPC, how will this capability make the production grow and improve inventory and security?
saw5 [17]

Answer:

RFID in a business setting as keycards to enter into specific rooms and Elevator control. RFID will eventually have more applications and security then Barcode.

Explanation:

6 0
4 years ago
Other questions:
  • If you were optimizing for performance and wanted to support potentially adding many new elements to an adt, then:
    12·1 answer
  • Database management systems _____. a. include transaction-processing reports for database analysis b. are used to create, organi
    6·1 answer
  • A network design engineer has been asked to design the IP addressing scheme for a customer network. The network will use IP addr
    6·1 answer
  • A forensic investigation discovered that accounts belonging to employees who were terminated numerous years ago were recently us
    9·1 answer
  • PLS HELP GIVING 100 POINTS TO THE PERSON WHO WRITES IT
    6·1 answer
  • PLEASE PLEASE PLEASE PLEASE PLEASE HELP! I'M BEGGING Y'ALL! I NEED THIS FOR TODAY! CORRECT ANSWERS WILL BE AWARDED BRAINLIEST!
    6·1 answer
  • Select the three early tools that were prototypes of modern farming tools used for harvesting crops.
    14·1 answer
  • You receive an email from a woman claiming her father was poisoned by business associates, but before his passing placed 12 mill
    12·2 answers
  • Which type of network cable is commonly used to connect office computers to the local network
    13·1 answer
  • What is Mobile Edge Computing? Explain in tagalog.​
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!