subject

PYTHONSorting 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. readlines() 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 seasons 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 (;). Next, sort the dictionary by values (alphabetical order), and output the results to a file named output_titles. txt. Ex: If the input is:file1.txtand the contents of file1.txt are:20Gunsmoke30The Simpsons10Will & Grace14Dallas20Law & Order12Murder, She Wrotethe file output_keys. txt should contain:10: Will & Grace12: Murder, She Wrote14: Dallas20: Gunsmoke; Law & Order30: The Simpsonsand the file output_titles. txt should contain:DallasGunsmokeLaw & OrderMurder, She WroteThe SimpsonsWill & Grace

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:30
In a compound condition, both conditions on either side of the logical operator and must be true for the overall condition to be true. a: true b: false
Answers: 1
question
Computers and Technology, 23.06.2019 07:10
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Visually impaired individuals generally rely on the for navigation. thus, designers need to ensure that mouse-specific inputs, such as pointing, clicking, and hovering, can be done without a mouse.
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Apunishment or the threat of punishment used to enforce conformity. select the best answer from the choices provided t f
Answers: 1
You know the right answer?
PYTHONSorting TV Shows (dictionaries and lists)Write a program that first reads in the name of an in...
Questions
question
Mathematics, 21.12.2019 09:31
question
Mathematics, 21.12.2019 09:31
question
History, 21.12.2019 09:31
question
Mathematics, 21.12.2019 09:31
question
Mathematics, 21.12.2019 09:31
Questions on the website: 13722367