Question
Please take this assignment in Python Write program start in below step: first reads in the name of an input file and then reads the
Please take this assignment in Python
Write program start in below step:
first reads in the name of an input file and then reads the input file using the readlines() method. The input file contains an unsorted list of TV shows with their corresponding number of seasons, followed by the corresponding rating of the show. This program should put all the contents of the input file into a dictionary where the TV show name is the key, and the list of one integer and one float is the value. The integer represents the number of seasons the TV show has run and the float represents the rating of the show. Examine the input file that I provide and will see that there is one show per line. Please use string methods and functions to separate what need get from each line, for example, the method split() is very useful for this project.
DATA
For example, If the input file name is: tv_shows.txt and the content of it is:
Rizzoli and Isles,7,7.6
Supernatural,15,8.4
Vampire Diaries,8,7.7
2 Broke Girls,6,6.7
Question Requirement
(1) read the file and build the dictionary as instructed;
(2) sort the dictionary and produce the file output_showNames.txt;
(3) sort the seasons in descending order and match them to the tv shows, produce the two lists in the order of the seasons;
(4) sort the ratings in ascending order and match them to the tv shows, produce the two lists in order of the ratings.
Thx.
Step 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