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
netineya [11]
3 years ago
15

Write a function named average_value_in_file that accepts a file name as a parameter and reads that file, assumed to be full of

numbers, and returns the average (mean) of the numbers in that file. The parameter, filename, gives the name of a file that contains a list of numbers, one per line. You may assume that the file exists and follows the proper format. For example, if a file named input.txt contains the following numbers
Computers and Technology
1 answer:
noname [10]3 years ago
6 0

def average_value_in_file(filename):

   f = open(filename)

   total = 0

   count = 0

   for x in f.read().splitlines():

       total += int(x)

       count += 1

   return total/count

print(average_value_in_file("input.txt"))

I used an input file that looks like this:

1

1

1

1

You might be interested in
If you wish to maintain a consistent style to all the documents you create, it would be helpful to use a _____.
Ket [755]

Hey!

Hope this helps...

~~~~~~~~~~~~~~~~~~~~~~~~~

It would be helpful to use a: template

This keeps the fonts, colors, background, headers, footers, all the same in any (or all) the documents you create that you want to look like in a certain way...

6 0
3 years ago
Most scheduling algorithms maintain a run queue, which lists processes eligible to run on a processor. On multicore systems, the
VMariaS [17]
No clue. This is because the morning shines bright in the evening.
7 0
2 years ago
Which business filing process puts documents or data in the order by date? a. Linear
ivanzaharov [21]

Answer:

d. Chronological

Explanation:

Chronological can be defined as an arrangement of data, items or documents in the order in which they occurred or happened (in time), from the earliest to the most recent or latest.

Hence, chronological order is a business filing process which puts documents or data in the order by date.

<em>For instance, the arrangement of documents in a shelf from January to December. </em>

3 0
3 years ago
Lucy has to move data from column A to column N in a worksheet. Which keys should she select to move data in the same worksheet?
UkoKoshka [18]
C. Select the source cell, press Ctrl + X, select the target cell, and then press Ctrl + V.
8 0
3 years ago
Read 2 more answers
The ___________ method returns the length of an array.
MaRussiya [10]

Answer:

A. Append

Explanation:

4 0
2 years ago
Read 2 more answers
Other questions:
  • You work in a customer call center. Martin is on the phone asking about the difference between solid-state drives (SSDs), hybrid
    6·1 answer
  • Write a Python program that gets a single character from the user and writes out a congratulatory message if the character is a
    9·1 answer
  • Generate the requested sets using only set builder notation and the provided sets. Some problems may require you to build one or
    15·1 answer
  • With microprocessors, The integration of a whole _____ onto a single chip or on a few chips greatly reduced the cost of processi
    14·1 answer
  • Enter the answer.
    11·2 answers
  • Write a Java program that generates GUI (Graphical User Interface). Your program should provide labels and textfields to a user
    9·1 answer
  • Your source data is of 50 GB. You make a full backup. Next week, once again you perform a full backup, but this time 10 more GB
    10·1 answer
  • How is data written to a blockchain?
    10·1 answer
  • St. CHarles school's music community is organizing a fundraiser. They want to create a simple but attractive website. However, t
    7·1 answer
  • What is the name for data generated by a computer using an algorithm?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!