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
Which of these are examples of data sources? Check all that apply.
Rama09 [41]

Answer: databases, electronic archives, online libraries, spreadsheets (B,C,E,F)

Explanation: I just took the test :)) hope u have a great day and remeber u are beautiful <3

4 0
2 years ago
Read 2 more answers
When you go to your school's computer support office, it will help if you have written down any _________ messages.
Finger [1]

Answer:

error

Explanation:

3 0
3 years ago
What method can be used to determine if an email link is authentic?
Sloan [31]
A password and pin hope this helps :D
3 0
3 years ago
What method parses its string argument to determine whether the string can be converted to a number?
den301095 [7]
The correct answer is: Tryparse method
6 0
3 years ago
What are the features of page layout
bagirrra123 [75]

Typical page layout decisions include:

Size of page margins.

Size and position of images and figures.

Deciding on the number and size of columns and gutters (gaps between columns)

Placement of intentional whitespace.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Is regular Facebook use healthy? Why or why not?
    10·2 answers
  • Explain how the operating system controls the software and hardware on the computer?
    5·1 answer
  • Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
    11·1 answer
  • Plain text and ASCII text are the same thing. true or false
    12·1 answer
  • Is it okay for potential employers to search your social media for use in determining if you are a fit for the position?
    15·1 answer
  • What is the decimal value for the jump control?
    8·1 answer
  • What is microsoft excel​
    9·2 answers
  • HELP ME PLEASE
    8·1 answer
  • Can I have some help?
    11·1 answer
  • What option would fit the most content on a page?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!