Question: 9.10 LAB: Sorting TV Shows (dictionaries and lists) Write a program that fist reads in the name of an ingat file and then reads the


9.10 LAB: Sorting TV Shows (dictionaries and lists) Write a program that fist reads in the name of an ingat file and then reads the input file using tive file readlines0 method The input file contains an unscrted list of number of seasons followed by the corresponding TV show Your propram should put the contents of the inout The into a dict conary where the number of seasons are the kers, and a list of TV stiows are the values (since mul cle shows could haverthe rame number of seasons) Sort the dictionary by key (greatest to (enst) and output the resuits to a file named output keys.tat Separate mu tipe TV shows associated with the same ker with a semicolon (;) orderng by appesrance in the input file Next, sort the dictionary by values (in reverse aiphabetical order), and output the resu ts to a file named output_titles. bxt Ex If the input is file1; txt and the coriterts of filel txt are 20 Gunimoke 30 The titimpion: 10 the file output keys txt should contain and the file output_titles.txt should contain: Will \& Grace The Simpsons Murder, She wrote Law \& Order Gunsmoke Dallas Note: End each output file with a newline, and file1.txt is available to download 9 10.1: LAB. Sorting TV Shows (dictionaries and lists) Downloadable files main.py
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
