Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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

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

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions

Question

305 mg of C6H12O6 in 55.2 mL of solution whats the molarity

Answered: 1 week ago

Question

List the different categories of international employees. page 642

Answered: 1 week ago

Question

Explain the legal environments impact on labor relations. page 590

Answered: 1 week ago