Process Scores Text File Suppose Text File Contains Unspecified Number Scores Write Progra Q37169863

(Process scores in a text file)

Suppose that a text file contains an unspecified number ofscores. Write a program that prompts the user to enter the filenameand reads the scores from the file and displays their total andaverage. Scores are separated by blanks. Your program should promptthe user to enter a filename.

Sample Run

Enter a filename: scores1.txt

There are 24 scores

The total is 800

The average is 33.33.

In Python.


Answer


filename = input(“Enter a filename: “)try: f = open(filename, ‘r’) count, total = 0, 0 for line in f:

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.