Answered step by step
Verified Expert Solution
Question
1 Approved Answer
*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 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.5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started