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 keysi, 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 resulta to a file named output keys.txt. Separate multiple TV shows associated with the same key with a semicolon (), ordering by appearance in the input file. Next, sort the dictionary by values (alphabetical order), and output the results to a file named output.titles.txt Ex If the input is:
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 keysi, 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 resulta to a file named output keys.txt. Separate multiple TV shows associated with the same key with a semicolon (), ordering by appearance in the input file. Next, sort the dictionary by values (alphabetical order), and output the results to a file named output.titles.txt Ex If the input is:
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
help on this python problem, make alternative and beginner's code

Transcribed Image Text:Write a program that first reads in the name of an input file and then reads the input file using the filereadlines) 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. Separate multiple TV shows associated
with the same key with a semicolon (), ordering by appearance in the input file. 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 file1.bxt are
20
Gunsnoke
30
The Simpsons
10
Will & Grace
14
Dallas
20
Law & Order
12
Murder, She Wrote
the file output keys. txt should contain
10: Mill s Grace
12: Murder, She Wrote
14: Dallas
20: Gunamoke: Law & Order
30: The Simpsona
and the file output titles.txt should contain:
Dallas
Gunamoke
Law & Order
Murder, She Hrote
The Simpsons
Will & Grace
Note: There is a newline at the end of each output file, and file1.txt is available to download.
20
Gunsmoke
30
Filel.txt
The Simpsons
10
Will & Grace
14
Dallas
20
Law & Order
12
Murder, She Wrote
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 4 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY