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
Create an Entity-Relationship Diagram with the following requirements.
melamori03 [73]

Answer:

idk

Explanation:

6 0
3 years ago
A collision between gas atoms and electrons raises the energy levels of oxygen and nitrogen in the _________.
Gala2k [10]
Ionosphere i hope this helps
4 0
3 years ago
Read 2 more answers
Why was the microchip essential to improving computers?
-BARSIC- [3]
Because it downsized the scale of the computer itself.

5 0
3 years ago
What are the possible consequences of plagiarism?
Semenov [28]

Answer:

Students who plagiarize or otherwise engage in academic dishonesty face serious consequences. Sanctions may include, but are not limited to, failure on an assignment, grade reduction or course failure, suspension, and possibly dismissal.

3 0
2 years ago
Which of the following uses replication to Infect multiple computers?
Nikolay [14]

Answer:

Trojan horse

Explanation:

mostly all the above mentioned use replication to infect computers but the one that uses replication to invest multiple computers at a time is Trojan horse.

hope it helps .

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following STEM discoverers developed a new type of computer hardware?
    11·1 answer
  • What color does Sam obtain when he mixes white with a color? Sam is painting a landscape and needs to paint the sky light blue.
    9·2 answers
  • In C please:
    5·1 answer
  • Select the characteristics that describe the evolution of computers that predate the personal computer (select all correct answe
    12·1 answer
  • From which type of data storage does the CPU load information for processing during normal operation?
    14·1 answer
  • In dos operating system ,write a command to delete the directory as well as the files of the directory ''world'' on drive E.
    15·1 answer
  • What will the computer do in response to a line of code reading # name = input("What is your name?")
    7·1 answer
  • It takes Mike 18 minutes to finish reading 4 pages of a book. How long would it take for him to finish 30 pages ?​
    9·1 answer
  • For angular how can we set up th edatabse.
    11·1 answer
  • Plagiarism is considered
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!