Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python You are given the following text. text = It was dark, like the bottom of a well. There was a pattern of skulls and

Python

You are given the following text.

text = "It was dark, like the bottom of a well. There was a pattern of skulls and bones around \

the frame, for the sake of appearances; Death could not look himself in the skull in a mirror \

with cherubs and roses around it. The Death of Rats climbed the frame in a scrabble of claws and \

looked at Death expectantly from the top. Quoth fluttered over and pecked briefly at his own \

reflection, on the basis that anything was worth a try. Show me, said Death, show me my thoughts. \

A chessboard appeared, but it was triangular, and so big that only the nearest point could be seen. \

Right on this point was the world - turtle, elephants, the little orbiting sun and all. It was the \

Discworld, which existed only just this side of total improbability and, therefore, in border country. \

In border country the border gets crossed, and sometimes things creep into the universe that have \

rather more on their mind than a better life for their children and a wonderful future in the \

fruit picking and domestic service industries. On every other black or white triangle of the \

chessboard, all the way to infinity, was a small grey shape, rather like an empty hooded robe."

You are also given a string that contains all symbols of the English alphabet.

alphabet = "abcdefghijklmnopqrstuvwxyz"

Write some code that generates the list unique_words, containing all and only the unique lowercase words from the text.

You should see the following output (the order can differ!):

['a', 'infinity', 'reflection', 'with', 'like', 'big', 'briefly', 'into', 'children', 'which', 'fruit', 'picking', 'there', 'try', 'little', 'around', 'appearances', 'appeared', 'all', 'crossed', 'basis', 'improbability', 'their', 'discworld', 'black', 'to', 'death', 'future', 'only', 'my', 'robe', 'things', 'for', 'it', 'existed', 'said', 'sake', 'sometimes', 'right', 'way', 'that', 'country', 'chessboard', 'quoth', 'well', 'domestic', 'skull', 'wonderful', 'hooded', 'or', 'empty', 'bottom', 'mirror', 'himself', 'rather', 'over', 'every', 'triangle', 'roses', 'border', 'orbiting', 'was', 'from', 'show', 'be', 'pecked', 'bones', 'just', 'universe', 'me', 'triangular', 'gets', 'worth', 'have', 'climbed', 'service', 'fluttered', 'top', 'but', 'grey', 'claws', 'at', 'rats', 'creep', 'own', 'pattern', 'point', 'white', 'than', 'dark', 'therefore', 'frame', 'this', 'not', 'the', 'could', 'mind', 'turtle', 'scrabble', 'better', 'industries', 'looked', 'an', 'cherubs', 'life', 'anything', 'more', 'small', 'and', 'of', 'his', 'on', 'skulls', 'elephants', 'in', 'thoughts', 'seen', 'nearest', 'expectantly', 'other', 'side', 'shape', 'total', 'so', 'world', 'look', 'sun']

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

What is the relation of physical mathematics with examples?

Answered: 1 week ago

Question

What are oxidation and reduction reactions? Explain with examples

Answered: 1 week ago