Problem: Villains and storiesYou are given a file called DrWhoVillains.tsv. It is a TAB separated file containing villains in ascience fiction show called Dr. Who. The show is actually known for its extremely low budget andsilly creature effects. Look at the picture of a Dalek (one of the main villains) above to see this foryourself. Each line of this file is a different villain, containing the following information (separatedby TABs):1. Villain: name of the villain (e.g. Dalek)2. Year first: the first year this villain was introduced3. Year last: the last year this villain was shown4. Doc. no.: the list of doctor ids with this villain, seperated by commas5. Doctor actor: the list of actors for each doctor above6. Episodes: number of episodes featuring this villain7. Stories, total: number of stories featuring this villain, each story mayspan many episodes8. Motivation (invasion earth, kill humans, etc): the description of the mainmotivation of this villain9. Story titles: the titles of the stories that the villain was involved with,a list of strings separated by commas.Your program must do the following: Read through the file to find the villain names and the (set of) stories for each villain. Becareful, the file is manually created and may have repeated names, extra spaces before afternames, etc. You must use sets to find unique stories. Find the top 10 most popular villains: those with top 10 highest number of stories listed inthe file and display them to the user, numbered 1 to 10, in the decreasing order of popularity.Then, ask the user for a number. If the user enters -1, the program exits. If the user enters something other than a number between 1 to 10, or -1, the program displaysthe top 10 list again and asks for another input. If the user enters a valid option, numbered between 1 to 10, then you find the correspondingvillain and display the following: The number of stories with this villain The names of all other villains that were in a story with this chosen villain, in alphabeticalorder. The names of all story lines that featured only this villain, and no other villain. If none,you should display there is no such story line.Once you are done displaying this, you will print again the top 10 and ask for the next input,until user enters -1.One thing you want to do is to display the names of matching villains and stories in a reasonablelooking paragraph. You do not have to match the output in the submission server exactly. Youshould however try to break the output into multiple lines of similar (but not necessarily identical)length. We will not take points off for breaking lines mid-word.There are many ways to do this. For example, what we did in the last homework is one way. Mysolution involves a module called textwrap which wraps text into a list of multiple lines. Try thefollowing to see if you can figure out how to use this module.import textwrapx = +*200textwrap.wrap(x,40)2Deliverables Final CheckHere is a summary of all the requirements for this homework. Double check this before you submit: Your program must use sets, that will also help you quite a lot. Submit a single file called hw6.py that assumes the existence of a text file called DrWhoVillains.tsv. The main loop of the program should be able to handle incorrect entry, repeated calls todisplay the top 10 villains, and exit when -1 entered. Print all input that you read immediately. The outputs containing multiple items like villains or stories should be a reasonable lookingparagraph, wrapping long lines into multiple lines. But the output does not have to be aperfect match for the submission server. Lines do not have to be the same length. Your program should print the villain names and story names in alphabetical order. Your program should have the required structure.Expected outputBelow you can see the expected functioning of this program with the file we gave you (note: wemight change the file in the homework submission server):1. Daleks2. Cybermen3. Master (the)4. Dalek Supreme (Supreme Dalek), inc Progenitor5. Sontarans6. Ice Warriors (inc benevolent appearences)7. Davros8. Silurians (exc Sea Devils)9. Kovarian, Madame10. Cyber-leaderPlease enter a number between 1 and 10, or -1 to endEnter a villain == stopstop1. Daleks2. Cybermen3. Master (the)4. Dalek Supreme (Supreme Dalek), inc Progenitor5. Sontarans6. Ice Warriors (inc benevolent appearences)7. Davros8. Silurians (exc Sea Devils)9. Kovarian, Madame10. Cyber-leaderPlease enter a number between 1 and 10, or -1 to endEnter a villain == 553Sontarans in 9 stories, with the following other villains:==================================================Alliance onscreen Daleks, Cybermen, Sontarans & Autons, (cameosSilurians, Sycorax, Judoon, Hoix, Roboforms, microcameos Blowfish,Uvodni, Weevils), Atraxi, Borusa, Chessene of the Franzine Grig,Cybermen, Dalek Supreme (Supreme Dalek), inc Progenitor, Daleks,Dastari, Joinson, Gray, Steve, Harris, Private Carl, Headless Monks,Irongron, Kovarian, Madame, Manton, Colonel, Martha Jones- Clone,Master (the), Naismith, Joshua, Rassilon, Rattigan, Luke, RedCarnivorous Maw, Shockeye of the Quawncing Grig, Silurians (exc SeaDevils), Staal, Stike, Vardan, Varl, VarlaThe stories that only features Sontarans are:==================================================The Sontaran Experiment1. Daleks2. Cybermen3. Master (the)4. Dalek Supreme (Supreme Dalek), inc Progenitor5. Sontarans6. Ice Warriors (inc benevolent appearences)7. Davros8. Silurians (exc Sea Devils)9. Kovarian, Madame10. Cyber-leaderPlease enter a number between 1 and 10, or -1 to endEnter a villain == 77Davros in 6 stories, with the following other villains:==================================================Dalek Supreme (Supreme Dalek), inc Progenitor, Daleks, Lytton,Commander Gustav, Movellans, Nyder, SharrelThere are no stories with only this villain==================================================1. Daleks2. Cybermen3. Master (the)4. Dalek Supreme (Supreme Dalek), inc Progenitor5. Sontarans6. Ice Warriors (inc benevolent appearences)7. Davros8. Silurians (exc Sea Devils)9. Kovarian, Madame10. Cyber-leaderPlease enter a number between 1 and 10, or -1 to endEnter a villain == -1-1Exiting
CSCI 1100 CSCI1100
[Solved] CSCI1100 Homework 6 Files and Sets
$25
File Name: CSCI1100_Homework_6_Files_and_Sets.zip
File Size: 320.28 KB
Only logged in customers who have purchased this product may leave a review.

![[Solved] CSCI1100 Homework 6 Files and Sets](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] CSCI1100 Homework 7 Dictionaries](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.