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
Complete the sentence about a presentation delivery method.
Nesterboy [21]
A Presentation software allows you to transmit your presentation over the internet using CDs
5 0
3 years ago
Jenn wants to assign a value to the favorite car variable: favoriteCar = Toyota but gets an error message. What does she need to
Valentin [98]

Answer:

The correct answer is:

Option D: Put Quotation marks around the string

Explanation:

There are various data types that are used to store data in programming i.e. numeric, alphabetic, alphanumeric etc.

Given that Jenn wants to store the value in variable. The names of cars are usually rods and the data type for them is string.

Whenever a string is used, quotation marks are used around it. The quotation marks make it easier for the compilers and interpreters to identify string.

Hence,

The correct answer is:

Option D: Put Quotation marks around the string

8 0
3 years ago
Convert the following binary numbers to their decimal equivalent: 11010111 11100011 1101
jekas [21]

Answer:

×ã   ?

Explanation:

5 0
4 years ago
6. Which of the following items is not a storage
stealth61 [152]

Answer:

Plotters

Explanation:

A 'plotter' is an external hardware device like a printer used with a computer to 'print vector graphics' - basically in english it no hold storage like that

5 0
3 years ago
Why are scientific journals considered more reliable sources than web pages for information about science? Web pages are too dif
Viefleur [7K]
<span>Scientific journals are read and openly criticized by many scientists. C</span>
3 0
4 years ago
Other questions:
  • Categorize the following relationships into generalization, aggregation, or association. Beware, there may be n-ary associations
    14·1 answer
  • What was the first<br> 1:search engine<br> 2:website<br> 3:time the internet started
    6·1 answer
  • Who is father of computer <br>​
    8·1 answer
  • A manufacturer of machine tools creates a spreadsheet of tools and their cost. The spreadsheet has four fields: name of the tool
    10·2 answers
  • TRUE OR FALSE! A query can have no more than three common interpretations.
    10·1 answer
  • If a file you are opening for appending does not exist, the operating system will detect the missing file and terminate the oper
    14·1 answer
  • Complete the sentence based on your knowledge of directing TV shows.
    10·1 answer
  • Cine stie repede va rog mult si repede
    9·1 answer
  • Write a program that asks the user for a word. Next, open up the movie reviews.txt file and examine every review one at a time.
    6·1 answer
  • A ……………………………is used to verify the identity of a website and is issued to the owner of the website by an independent and recogni
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!