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
denpristay [2]
3 years ago
9

Write a program that lets the user enter in a file name (numbers.txt) to read, keeps a running total of how many numbers are in

the file, calculates and prints the average of all the numbers in the file. This must use a while loop that ends when end of file is reached. This program should include FileNotFoundError and ValueError exception handling. Sample output: Enter file name: numbers.txt There were 20 numbers in the file. The average is 4.35

Computers and Technology
1 answer:
lina2011 [118]3 years ago
3 0

Answer:

Check the explanation

Explanation:

The code will be

name=input('Enter file name:')

ls=open(name,'r').read().split('\n')

count=0;sums=0

for i in range(ls):

sums+=int(i)

count+=1

print('There were {} numbers in the file'.format(count))

print('The average is {}'.format(sums/count))

The output is

You might be interested in
What is looping in QBASIC​
Elden [556K]

A looping is a set of instructions which is repeated a certain number of times until a condition is met. hlo dai k xa halkhabar

3 0
3 years ago
Help me please. i need you help​
Fudgin [204]

Answer:

Can you provide the code

7 0
3 years ago
PLZ HELP!!!
mariarad [96]
Answer: A. Usability testing
Explanation:
Usability testing would be the correct answer because if the user interface isn't "frendly" then people won't be able to use it properly. Or if you are refering to the word friendly as looking safe, then even more so would be usability testing. Because if people don't like the fonts and styles of the user interface, they might not use it at all.
8 0
3 years ago
Is a display, or monitor, considered a piece of computer hardware
9966 [12]
Yes. The monitor is considered as a piece of Computer Hardware. Computer hardware is what you can physically touch, like the keyboard, mouse, monitor, disk drive, and so on.

I hope this answers your question.

Thank you,
Otaku
3 0
3 years ago
How can i get a java complier for linux and ubuntu?
egoroff_w [7]
You can install Eclipse. If you want you can look into the Ubuntu store and see if they have any.
5 0
3 years ago
Other questions:
  • If you find yourself boxed in by a vehicle on your left or right _____________
    14·2 answers
  • HTTP is made to facilitate which kind of communication?
    11·1 answer
  • On the Insert tab, select Table > _______ to create a table from selected text.
    14·1 answer
  • From the standpoint of the governing bodies of .com, why is it important that owners of individual domains maintain authoritativ
    5·1 answer
  • One of the most common uses of spreadsheet programs are communicating with others. O editing images and photos. O tracking and m
    8·2 answers
  • . If you have written the following source code:
    9·1 answer
  • My friend Leo wants to have an emergency plan for his final exams on University of Southern Algorithmville. He has N subjects to
    6·1 answer
  • Where do animators work?
    8·1 answer
  • What are two options available for highlighting changes in the Highlight Changes dialog box?
    11·2 answers
  • Fill in the word to complete the sentence.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!