Question: (Python) In this lab you will complete a program to generate Shakespearean insults! The Starter Code The starter code includes two lists: A list of

(Python) In this lab you will complete a program to generate Shakespearean insults!

The Starter Code

The starter code includes two lists:

  • A list of adjectives
  • A list of nouns

Each adjective is prefixed with the appropriate indefinite article (either 'a' or 'an').

The Task at Hand

Your job is to create a randomized insult, constructed from three adjectives and a noun.

To do this, you need to:

  1. Get a random seed (integer) from the user.
  2. Set the seed on the random number generator.
    • Only pass the integer to the function (ignore the version parameter)
  3. Shuffle the two lists.
    • Be sure to shuffle adjectives first, and nouns second.
  4. Extract three adjectives and a noun, using .pop().
    • Note that a list is a mutable sequence type.
    • Be sure to use pop() with no arguments, to take the last element from the list each time.
    • Pop three adjectives (one at a time), then pop one noun.
  5. Find and remove the article ('a'/'an') from the 2nd and 3rd adjectives.
    • Hint: use string slicing to evaluate a substring that omits the article.
  6. Construct and print the insult.

Some Sample Runs

Enter your insult number (an integer): 23 "Thou art an untoward, oderiferous, tedious toad!" 
Enter your insult number (an integer): 5 "Thou art a mad headed, naughty, ruinious knave!" 
Enter your insult number (an integer): 42 "Thou art a troublesome, unwashed, naughty carbuncle!"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!