Question: *SOLUTION REQUIRED IN PYTHON* Task 4 Dictionaries + Lists + File IO Assume you are given a text file containing a list of authors and

 *SOLUTION REQUIRED IN PYTHON* Task 4 Dictionaries + Lists + File

*SOLUTION REQUIRED IN PYTHON*

Task 4 Dictionaries + Lists + File IO Assume you are given a text file containing a list of authors and a rating. You need to read the entire file and make a dictionary such that each candidate is the key and the ratings are the values (this will be a list). You need to also print the average rating for each author. Take the file name from the user and if the file is not found, print out the following message: "File could not be found" Sample Input (input.txt) Dostoevsky 5 Tolstoy 4 Tolstoy 4 Chekov 3 Chekov 2 Dostoevsky 5 Dostoevsky 4 Dostoevsky 2 Output for Sample Input (output.txt) Dictionary: {"Dostoevsky": [5, 5, 4, 2], "Tolstoy": [4,4], "Chekov": [3,2]} Average rating for each author: Dostoevsky: 4.0 Tolstoy: 4.0 Chekov: 1.5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!