Answer:
- import statistics
- def st_dev(file_name):
- with open(file_name) as file:
- data = file.readlines()
- numList = []
- for x in data:
- numList.append(int(x))
-
- return statistics.pstdev(numList)
- 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
Answer:
Explanation:
The constant function is useful in algorithm analysis, because it characterizes the number of steps needed to do a basic operation on a computer, like adding two numbers, assigning a value to some variable, or comparing two numbers. Executing one instruction a fixed number of times also needs constant time only.
Answer: The differences between ultra-book, tablet and slate PC are mentioned as follows:-
- Ultra-book is the notebook structure thin and slim device whereas tablets are type of computer shaped laptops in small size and slate PC has detachable display screen and is a replacement of tablet .
- Ultra-books have large and handy keyboards, tablets have touchscreen and no keyboard presence whereas slate PC has the touchscreen operated through stylus or fingers.
- Ultra-book have good storage space while tablets and slate PC's have less storage space in comparison.
The CPU performs basic arithmetic, logic, controlling, and input/output (I/O) operations specified by the instructions in the program. This contrasts with external components such as main memory and I/O circuitry, and specialized processors such as graphics processing units (GPUs).
The answer is 'D', as obvious as it seems...