Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

*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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

1. Who will you assemble on the team?

Answered: 1 week ago

Question

4. Who would lead the group?

Answered: 1 week ago