Answered step by step
Verified Expert Solution
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:
- Get a random seed (integer) from the user.
- Set the seed on the random number generator.
- Only pass the integer to the function (ignore the version parameter)
- Shuffle the two lists.
- Be sure to shuffle adjectives first, and nouns second.
- 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.
- 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.
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started