Question

In: Computer Science

Use Python. Create a Shakespearean Insult Generator The generator takes one element / data chunk from...

Use Python.

Create a Shakespearean Insult Generator

The generator takes one element / data chunk from each list and
combines them to form the Shakespearean Insult.

For example - List1 - artless
List2 - beef-witted
List3 - barnacle
Result - Thou is a artless beef-witted barnacle
  
Your program will have three modes.
There is the automatically mode where the program will randomly
select one element from each column and combine them.

The second mode is the user is presented with each list one at a time
and the user chooses one insult from each list. The program then puts
them together.

The third mode is where the user can add or delete an item
from any list they choose. Note you will need print the list so they can
see the items.

**** PRINT THE LISTS USING A LOOP ****


List1 = ['artless', 'bawdy', 'beslubbering', 'bootless', 'churlish',
'cockered', 'clouted', 'craven', 'currish', 'dankish', 'dissembling',
'droning', 'errant', 'fawning', 'fobbing', 'froward', 'frothy',
'gleeking', 'goatish', 'gorbellied', 'impertinent', 'infectious',
'jarring', 'loggerheaded', 'lumpish', 'mammering', 'mangled',
'mewling', 'paunchy', 'pribbling', 'puking', 'puny', 'qualling',
'rank', 'reeky', 'roguish', 'ruttish', 'saucy', 'spleeny',
'spongy', 'surly', 'tottering', 'unmuzzled', 'vain',
'venomed', 'villainous', 'warped', 'wayward', 'weedy', 'yeasty']


List2 = ['base-court', 'bat-fowling', 'beef-witted', 'beetle-headed',
'boil-brained', 'clapper-clawed', 'clay-brained', 'common-kissing',
'crook-pated', 'dismal-dreaming', 'dizzy-eyed', 'doghearted',
'dread-bolted', 'earth-vexing', 'elf-skinned', 'fat-kidneyed',
'fen-sucked', 'flap-mouthed', 'fly-bitten', 'folly-fallen',
'fool-born', 'full-gorged', 'guts-griping', 'half-faced',
'hasty-witted', 'hedge-born', 'hell-hated', 'idle-headed',
'ill-breeding', 'ill-nurtured', 'knotty-pated', 'milk-livered',
'motley-minded', 'onion-eyed', 'plume-plucked', 'pottle-deep',
'pox-marked', 'reeling-ripe', 'rough-hewn', 'rude-growing',
'rump-fed', 'shard-borne', 'sheep-biting', 'spur-galled',
'swag-bellied', 'tardy-gaited', 'tickle-brained',
'toad-spotted', 'unchin-snouted', 'weather-bitten']


List3 - ['apple-john', 'baggage', 'barnacle', 'bladder', 'boar-pig',
'bugbear', 'bum-bailey', 'canker-blossom', 'clack-dish', 'clotpole',
'coxcomb', 'codpiece', 'death-token', 'dewberry', 'flap-dragon',
'flax-wench', 'flirt-gill', 'foot-licker', 'fustilarian', 'giglet',
'gudgeon', 'haggard', 'harpy', 'hedge-pig', 'horn-beast',
'hugger-mugger', 'joithead', 'lewdster', 'lout', 'maggot-pie',
'malt-worm', 'mammet', 'measle', 'minnow', 'miscreant', 'moldwarp',
'mumble-news', 'nut-hook', 'pigeon-egg', 'pignut', 'puttock',
'pumpion', 'ratsbane', 'scut', 'skainsmate', 'strumpet', 'varlot',
'vassal', 'whey-face', 'wagtail']

"""

Solutions

Expert Solution

The code is given below, If you use copy paste please be carefull because it might mess up the spacing:

Match the spacing as given in images attached:

If you have any problem understanding it, ask in comments below:

import random        # to use randomly selecting one item from list

List1 = ['artless', 'bawdy', 'beslubbering', 'bootless', 'churlish',

'cockered', 'clouted', 'craven', 'currish', 'dankish', 'dissembling',

'droning', 'errant', 'fawning', 'fobbing', 'froward', 'frothy',

'gleeking', 'goatish', 'gorbellied', 'impertinent', 'infectious',

'jarring', 'loggerheaded', 'lumpish', 'mammering', 'mangled',

'mewling', 'paunchy', 'pribbling', 'puking', 'puny', 'qualling',

'rank', 'reeky', 'roguish', 'ruttish', 'saucy', 'spleeny',

'spongy', 'surly', 'tottering', 'unmuzzled', 'vain',

'venomed', 'villainous', 'warped', 'wayward', 'weedy', 'yeasty']

List2 = ['base-court', 'bat-fowling', 'beef-witted', 'beetle-headed',

'boil-brained', 'clapper-clawed', 'clay-brained', 'common-kissing',

'crook-pated', 'dismal-dreaming', 'dizzy-eyed', 'doghearted',

'dread-bolted', 'earth-vexing', 'elf-skinned', 'fat-kidneyed',

'fen-sucked', 'flap-mouthed', 'fly-bitten', 'folly-fallen',

'fool-born', 'full-gorged', 'guts-griping', 'half-faced',

'hasty-witted', 'hedge-born', 'hell-hated', 'idle-headed',

'ill-breeding', 'ill-nurtured', 'knotty-pated', 'milk-livered',

'motley-minded', 'onion-eyed', 'plume-plucked', 'pottle-deep',

'pox-marked', 'reeling-ripe', 'rough-hewn', 'rude-growing',

'rump-fed', 'shard-borne', 'sheep-biting', 'spur-galled',

'swag-bellied', 'tardy-gaited', 'tickle-brained',

'toad-spotted', 'unchin-snouted', 'weather-bitten']

List3 =['apple-john', 'baggage', 'barnacle', 'bladder', 'boar-pig',

'bugbear', 'bum-bailey', 'canker-blossom', 'clack-dish', 'clotpole',

'coxcomb', 'codpiece', 'death-token', 'dewberry', 'flap-dragon',

'flax-wench', 'flirt-gill', 'foot-licker', 'fustilarian', 'giglet',

'gudgeon', 'haggard', 'harpy', 'hedge-pig', 'horn-beast',

'hugger-mugger', 'joithead', 'lewdster', 'lout', 'maggot-pie',

'malt-worm', 'mammet', 'measle', 'minnow', 'miscreant', 'moldwarp',

'mumble-news', 'nut-hook', 'pigeon-egg', 'pignut', 'puttock',

'pumpion', 'ratsbane', 'scut', 'skainsmate', 'strumpet', 'varlot',

'vassal', 'whey-face', 'wagtail']

# mode 1st

print("Result: Thou is a",random.choice(List1), random.choice(List2),random.choice(List3))

# mode 2nd

print("Choose any word from the given 1st list: ")

# Using loop to display lists

for word in List1:

  print(word)

word1 = str(input())

print("Choose any word from the given 2nd list: ")

for word in List2:

  print(word)

word2 = str(input())

print("Choose any word from the given 3nd list: ")

for word in List3:

  print(word)

word3 = str(input())

if word1 in List1 and word2 in List2 and word3 in List3:

  print("Result: Thou is a",word1,word2,word3)

else:

  print("Invalid input, Choose words from list only!")


# mode 3rd

# for deleting from 1st list

print("Enter the word from 1st list to delete: ")

print("List1: ")

for word in List1:

  print(word)

delete1 = str(input())

if delete1 in List1:

  List1.remove(delete1)

else:

  print("Item not in list.")

# for deleting from 2nd list

print("Enter the word from 2nd list to delete: ")

print("List1: ")

for word in List2:

  print(word)

delete2 = str(input())

if delete2 in List2:

  List2.remove(delete2)

else:

  print("Item not in list.")

# for eleting from 3rd list

print("Enter the word from 2nd list to delete: ")

print("List1: ")

for word in List3:

  print(word)

delete3 = str(input())

if delete3 in List3:

  List3.remove(delete3)

else:

  print("Item not in list.")



import random        # to use randomly selecting one item from list

List1 = ['artless', 'bawdy', 'beslubbering', 'bootless', 'churlish',
'cockered', 'clouted', 'craven', 'currish', 'dankish', 'dissembling',
'droning', 'errant', 'fawning', 'fobbing', 'froward', 'frothy',
'gleeking', 'goatish', 'gorbellied', 'impertinent', 'infectious',
'jarring', 'loggerheaded', 'lumpish', 'mammering', 'mangled',
'mewling', 'paunchy', 'pribbling', 'puking', 'puny', 'qualling',
'rank', 'reeky', 'roguish', 'ruttish', 'saucy', 'spleeny',
'spongy', 'surly', 'tottering', 'unmuzzled', 'vain',
'venomed', 'villainous', 'warped', 'wayward', 'weedy', 'yeasty']

List2 = ['base-court', 'bat-fowling', 'beef-witted', 'beetle-headed',
'boil-brained', 'clapper-clawed', 'clay-brained', 'common-kissing',
'crook-pated', 'dismal-dreaming', 'dizzy-eyed', 'doghearted',
'dread-bolted', 'earth-vexing', 'elf-skinned', 'fat-kidneyed',
'fen-sucked', 'flap-mouthed', 'fly-bitten', 'folly-fallen',
'fool-born', 'full-gorged', 'guts-griping', 'half-faced',
'hasty-witted', 'hedge-born', 'hell-hated', 'idle-headed',
'ill-breeding', 'ill-nurtured', 'knotty-pated', 'milk-livered',
'motley-minded', 'onion-eyed', 'plume-plucked', 'pottle-deep',
'pox-marked', 'reeling-ripe', 'rough-hewn', 'rude-growing',
'rump-fed', 'shard-borne', 'sheep-biting', 'spur-galled',
'swag-bellied', 'tardy-gaited', 'tickle-brained',
'toad-spotted', 'unchin-snouted', 'weather-bitten']

List3 =['apple-john', 'baggage', 'barnacle', 'bladder', 'boar-pig',
'bugbear', 'bum-bailey', 'canker-blossom', 'clack-dish', 'clotpole',
'coxcomb', 'codpiece', 'death-token', 'dewberry', 'flap-dragon',
'flax-wench', 'flirt-gill', 'foot-licker', 'fustilarian', 'giglet',
'gudgeon', 'haggard', 'harpy', 'hedge-pig', 'horn-beast',
'hugger-mugger', 'joithead', 'lewdster', 'lout', 'maggot-pie',
'malt-worm', 'mammet', 'measle', 'minnow', 'miscreant', 'moldwarp',
'mumble-news', 'nut-hook', 'pigeon-egg', 'pignut', 'puttock',
'pumpion', 'ratsbane', 'scut', 'skainsmate', 'strumpet', 'varlot',
'vassal', 'whey-face', 'wagtail']
# mode 1st 
print("Result: Thou is a",random.choice(List1), random.choice(List2),random.choice(List3))


# mode 2nd
print("Choose any word from the given 1st list: ")
# Using loop to display lists
for word in List1:
  print(word)
word1 = str(input())
print("Choose any word from the given 2nd list: ")
for word in List2:
  print(word)
word2 = str(input())
print("Choose any word from the given 3nd list: ")
for word in List3:
  print(word)
word3 = str(input())
if word1 in List1 and word2 in List2 and word3 in List3:
  print("Result: Thou is a",word1,word2,word3)
else:
  print("Invalid input, Choose words from list only!")



# mode 3rd
# for deleting from 1st list
print("Enter the word from 1st list to delete: ")
print("List1: ")
for word in List1:
  print(word)
delete1 = str(input())
if delete1 in List1:
  List1.remove(delete1)
else:
  print("Item not in list.")
# for deleting from 2nd list
print("Enter the word from 2nd list to delete: ")
print("List1: ")
for word in List2:
  print(word)
delete2 = str(input())
if delete2 in List2:
  List2.remove(delete2)
else:
  print("Item not in list.")
# for eleting from 3rd list
print("Enter the word from 2nd list to delete: ")
print("List1: ")
for word in List3:
  print(word)
delete3 = str(input())
if delete3 in List3:
  List3.remove(delete3)
else:
  print("Item not in list.")



If you find it helpful, please upvote thanks!


Related Solutions

python practice! 1. Create a function that takes a user choice and one number as parameters...
python practice! 1. Create a function that takes a user choice and one number as parameters and returns the operation result. -Square: print the number square -Sqrt: print the square root of the number -Reverse: reverse the sign of the number (pos or neg) and print it Note: Detect invalid choices and throw an error message – Number can be anything. 2. Create a function that takes a user choice and two numbers (start and end) as parameters. For example,...
In python I have a linked list. I want to create one function that takes in...
In python I have a linked list. I want to create one function that takes in one parameter, head. In the function, cur = head and next_cur = head.next. I want to return head and next_cur, except at the end of the function they will return alternating values from head. For example, if the these are the values in the linked list: 2, 3, 5, 7, 11 after the function head should return: 2, 5, 11 and next_cur should return:...
Q.1: create a python function that takes two integers from the user ( pass them from...
Q.1: create a python function that takes two integers from the user ( pass them from the main program). The function performs the addition operation and returns the result. In the program, ask the user to guess the result. Then, the program compares the user input ( guess) with the returned value, and displays a message that tells if the user guessing is correct or not. --define the function here --- # the program starts here print(“ This program tests...
The first random number generator comes from Python itself. To use it you need to import...
The first random number generator comes from Python itself. To use it you need to import the Python package. Then call the random() method. See below. import random print (random.random()) It is important to know that a random number generator really is random. If so, it should have uniform distribution between 0 and 1. Test the random number generators in Python for uniformity.
Use Random number generator (under Data Analysis) to simulate the following data set. Create 10 columns,...
Use Random number generator (under Data Analysis) to simulate the following data set. Create 10 columns, each 20 points long and use the following parameters: Number of variables (10), number of data point (20), Distribution (Normal), Mean (40), Standard Deviation (10), Random seed (1234). The data should be in columns: A,B,C,….,I,J. Randomly pick two columns (say Column B and Column H) and perform 2-sided t-test on these two data columns. Record the P-value and repeat this procedure several times (at...
Python HW Open a new Jupyter notebook Create a new function named fibonacci() that takes one...
Python HW Open a new Jupyter notebook Create a new function named fibonacci() that takes one required parameter: maxint, an integer that will serve as the upper bound of the loop Following the example on the Python tutorial: https://docs.python.org/3/tutorial/introduction.html#first-steps-towards-programming Our implementation will have a few changes: While you will use a while loop to make a Fibonacci sequence, the upper bound of the sequence will be your maxint parameter. Store the results into a list and append each new generated...
USE PYTHON Create a single list that contains the following collection of data in the order...
USE PYTHON Create a single list that contains the following collection of data in the order provided: [1121, "Jackie Grainger", 22.22, 1122, "Jignesh Thrakkar", 25.25, 1127, "Dion Green", 28.75, False, 24.32, 1132, "Jacob Gerber", "Sarah Sanderson", 23.45, 1137, True, "Brandon Heck", 1138, 25.84, True, 1152, "David Toma", 22.65, 23.75, 1157, "Charles King", False, "Jackie Grainger", 1121, 22.22, False, 22.65, 1152, "David Toma"] The data above represents employee information exported from an Excel spreadsheet. Whomever typed the data in originally didn't...
Using Python, create a function whose inputs are two matrices and whose output is the element...
Using Python, create a function whose inputs are two matrices and whose output is the element wise product of the two matrices.
In python I want to create a function that takes in a linked list. Using recursion...
In python I want to create a function that takes in a linked list. Using recursion only, I want to check if the linked list is sorted. How do i do this?
In python I want to create a singular function that takes two parameters 'head; and 'skip'....
In python I want to create a singular function that takes two parameters 'head; and 'skip'. Head is a linked list. Skip is a non negative value. If skip is zero it should return the linked list unchanged. The skip amount determines the amount to skip over. I want to change the linked list accordingly and then return the linked list with the modifications, not a list. If you have a linked list 11 -> 12 -> 18 -> 20...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT