Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Python: You will use a file containing various beasts that were featured in different titles in the Harry Potter series of books and movies.

Use Python:

You will use a file containing various beasts that were featured in different titles in the Harry Potter series of books and movies. We give you a simple data file called titles.txt to test your program, but we will be working on a more comprehensive one for Submitty. Each line of the file contains a title (movie or book), followed by all the beasts featured in this title.

For example, the following line: Harry Potter and the Goblet of Fire|Hippocampus|Merpeople|Niffler mentions that the title Harry Potter and the Goblet of Fire featured three beasts: Hippocampus, Merpeople and Niffler. You can assume that the data is valid and that splitting on the '|' string will correctly parse the lines in titles.txt

Your program must do the following: Read the name of a title from the user. The user will enter any part of the title (in any case, upper or lower). Find the first title in the list that contains the input string.

For example, the user may enter FIRE, which will match the above line. If no match is found, print the message.

If a match is found, then do the following:

Print all the beasts that were featured in this title in lexicographical order

Print all the other titles that have at least one beast in common with this title in lexicographical order

Print all the beasts that were featured only in this title (i.e. no other title has these beasts), again in lexicographical order Consider which set operation will help with the last two operations . . .

Once you have finished processing the input (match or no match), ask for another input, until the user inputs stop

This is the given txt fileimage text in transcribed

titles.txt Fantastic Beasts |Ashwinder[Hippocampus |Occamy |Doxy|Diricawl|Swooping Evil|Demiguisel Graphorn INundu | Bowtruckle | FwooperlBillywig Mooncalf | Lethifold |Thestral Murtlap| Runespoor|Erumpent Harry Potter and the Order of the PhoenixIMurtlap Doxy | Bowtruckle IThestral Harry Potter and the Cursed Child|Demiguise Harry Potter and the Deathly Hallows |Erumpent the Wizarding World of Harry Potter Fwooper Harry Potter and the Goblet of Fire|Hippocampus |Merpeople |Niffler Harry Potter and the Prisoner of Azkaban | Kappa Pottermore |Sasquatch |Thunderbird titles.txt Fantastic Beasts |Ashwinder[Hippocampus |Occamy |Doxy|Diricawl|Swooping Evil|Demiguisel Graphorn INundu | Bowtruckle | FwooperlBillywig Mooncalf | Lethifold |Thestral Murtlap| Runespoor|Erumpent Harry Potter and the Order of the PhoenixIMurtlap Doxy | Bowtruckle IThestral Harry Potter and the Cursed Child|Demiguise Harry Potter and the Deathly Hallows |Erumpent the Wizarding World of Harry Potter Fwooper Harry Potter and the Goblet of Fire|Hippocampus |Merpeople |Niffler Harry Potter and the Prisoner of Azkaban | Kappa Pottermore |Sasquatch |Thunderbird

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions

Question

What limitations would Liam need to concede in his write-up?

Answered: 1 week ago