answer.
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]
2 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]2 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
How can rows be added to a table? Check all that apply
svlad2 [7]
<h2><em>1) By drawing a row in the table using the draw option. </em></h2><h2><em> </em></h2><h2><em>2) By using the insert option under the Table Tools tab. </em></h2><h2><em> </em></h2><h2><em>3) By designing the table with an added row using the Design tab.</em></h2><h2><em></em></h2><h2><em>HOPE IT HELPS (◕‿◕✿)</em></h2>
6 0
1 year ago
Read 2 more answers
To explain acceptable computer use to their employees, students, or other users, many organizations and educational institutions
docker41 [41]

Answer:

Codes of conduct

Explanation:

Codes of conduct are a set of rules or norms established by an organization for all employees, students or users, to ensure individual responsibilities and proper practices. The code of conduct can cover overall behaviour of individuals in an organization, but a specific code of conduct can be developed for proper computer use in order to establish what is appropriate and available to use in the organization´s computers, and also to restrict or avoid non related content.

7 0
1 year ago
Read 2 more answers
How to write a program that prompts the user to input two POSITIVE numbers — a dividend (numerator) and a divisor (denominator).
fomenos

Answer:

num1 = int(input("Numerator: "))

num2 = int(input("Denominator: "))

if num1 < 1 or num2<1:

     print("Input must be greater than 1")

else:

     print("Quotient: "+str(num1//num2))

     print("Remainder: "+str(num1%num2))

Explanation

The next two lines prompts the user for two numbers

<em>num1 = int(input("Numerator: "))</em>

<em>num2 = int(input("Denominator: "))</em>

The following if statement checks if one or both of the inputs is not positive

<em>if num1 < 1 or num2<1:</em>

<em>      print("Input must be greater than 1")-> If yes, the print statement is executed</em>

If otherwise, the quotient and remainder is printed

<em>else:</em>

<em>      print("Quotient: "+str(num1//num2))</em>

<em>      print("Remainder: "+str(num1%num2))</em>

<em />

3 0
2 years ago
As the network administrator for a growing company, you’re asked to solve a remote access dilemma. The 12 employees who work fro
Strike441 [17]

Answer:

To provide remote network access to the users to work, the network administrator can use virtual private network (VPN) along with some firewall to protect the system from hackers and other security threats.

Explanation:

Virtual Private Network (VPN) can be used to provide remote access to the users who are currently working from some remote areas. Many companies who have their branches or franchises in different parts of the city uses VPN to connect then all with the company server.

In this way, a firewall has been needed that protect the systems of users as well as company to protect from different security hazards such as hackers, authorization of the users and other security threats.

in this case, 12 em[employees who need remote access to the network can be connected through VPN along with the installation of some suitable firewall.

8 0
2 years ago
Why is it important to set a strict password policy as part of your security template?
kari74 [83]
So that its well secured and not misused by unauthorized persons
6 0
2 years ago
Other questions:
  • Based on a kc value of 0.150 and the data table given, what are the equilibrium concentrations of xy, x, and y, respectively?
    9·1 answer
  • On the Picture Tools Layout tab, you can preview results of the numerous styles, borders, effects, and layouts by _______ comman
    7·2 answers
  • Gabe wants to move text from one document to another document. He should _____.
    10·2 answers
  • Write the 8-bit signed-magnitude, two's complement, and ones' complement representations for each decimal number: +25, + 120, +
    11·1 answer
  • Brittany just pulled up a database table with employee information that contains 50 records of employees at her company. Which o
    12·1 answer
  • Which type of word processing programs enables us to include illustrations within the program?
    6·1 answer
  • When this program is compiled and executed on an x86-64 Linux system, it prints the string 0x48\n and terminates normally, even
    14·1 answer
  • array of String objects, words, has been properly declared and initialized. Each element of words contains a String consisting o
    11·1 answer
  • A _______ bulb contains a high-pressure gas. Oils from the hands can affect the expansion of the glass, which can shorten the li
    13·1 answer
  • A program is divided into 3 blocks that are being compiled on 3 parallel computers. Each block takes an Exponential amount of ti
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!