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, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
question
Computers and Technology, 24.06.2019 02:00
Which steps will open the system so that you can enter a question and do a search for
Answers: 1
question
Computers and Technology, 24.06.2019 21:00
When replacing a thermostat or water pump, coolant drained from the cooling system should be
Answers: 1
question
Computers and Technology, 25.06.2019 01:00
Why was it important for the date format to be standardized by the international organization for standardization
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
Questions on the website: 13722362