Question: hello, kindly help. please use Python 7.9 LAB: Sorting TV Shows (dictionaries and lists) Write a program that first reads in the name of an
7.9 LAB: Sorting TV Shows (dictionaries and lists) Write a program that first reads in the name of an input file and then reads the input file using the file readines0 method The input file contains an unsorted list of number of seasons followed by the corresponding TV show. Your program should put the contents of the input file into a dictionary where the number of seasans are the keys, and a list of TV shows are the values (since multiple shows could have the same number of seasons). Sort the dictionary by key (least to greatest) and output the results to a file named output keys.txt, separating multiple TV shows associated with the same key with a semicolon (6). Next sort the dictionary by values (alphabetical order), and output the results to a file named output titles.txt. Ex if the input is: filel.txt and the contents of filel.bxt are: 20 Gunsmoke 30 The Simpsons 10 Will \& Grace 14 Da1las 20 Iaw 6 Order 12 Murder. She Wrote the file output keys txt should contain: 10: Wi11 6 Grace 12: Murder, She Wrote 14: Dallas 20: Gungmoke; Law \& order 30: The Simpsons. and the file output tities. bxt should contain
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
