Question

Using Python, students will use variables, input, and printing to create a Mad Lib. The program...

Using Python, students will use variables, input, and printing to create a Mad Lib.

The program will print out the title of the Mad Libs story, as well as a short explanation of game play:

The program should then prompt the user to enter in nouns, verbs, adjectives, proper nouns, and adverbs:

Enter a proper noun:

Enter a place:

Enter another place:

Enter an adverb:

Enter a noun:

Enter an adjective:

Enter an adverb:

Enter a verb:

Enter a place:

Enter an adjective:

As mentioned above the program must request words from the user. The following can be included in the program:

  • 10 different words inputted

  • Variable names should correspond to the part of speech requested and part of the story they belong to (e.g. noun1, verb2, etc)

  • You may only use 3 print statements to tell your story

Homework Answers

Answer #1

Dear Learner,

Here is the solution code

def MadLibsStory(): #function definition
  
   print("Enter a proper noun:")
   properNoun = input() #asking for properNoun
   print("Enter a place:")
   place1 = input()#taking first place input
   print("Enter another place:")
   place2 = input()#taking second place input (notice the name of the variable)
   print("Enter an adverb:")
   adverb = input()#taking input for adverb
   print("Enter a noun:")
   noun = input()#asking for a noun
   print("Enter an adjective:")
   adjective = input()#taking input for an adjective
   print("Enter an adverb:")
   adverb2 = input() #taking second adverb
   print("Enter a verb:")
   verb = input()# asking for a verb
   print("Enter a place:")
   place3 = input()# asking for a third place
   print("Enter an adjective:")
   adjective2 = input() #taking second adjective

   print("During the war of 2427, "+adjective+" countries like "+place1+" were trying to attack "+place2+".") #print statement 1
   print("But the "+adjective2+" king "+properNoun+", with his "+noun+" protected his country very "+adverb+".") #print statement 2
   print("Then his brother came from "+place3+" and "+verb+" him "+adverb2+".") # print statement 3

print("Welcome to Mad Libs Story")
print("Enter the requested words to generate a story")
MadLibsStory() #function call

SCREENSHOT OF THE CODE:

SAMPLE OUTPUT:-

I hope I have answered the question the way you were expecting. If you still have any doubts or want any further explanation, feel free to ask us in the comment section.

Please leave a like if this was helpful.

Thanks,

Happy Studying.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a C program that plays a game of ​Mad Libs​ with the user. Specifically, the...
Write a C program that plays a game of ​Mad Libs​ with the user. Specifically, the program should do the following: a. Declare five character arrays of size 20. b. Prompt the user, five times, to enter a word of some type. Each word is stored in a different character array. The word types could be vague, such as "noun," "adjective," or "adverb," or they could be specific, such as "color," "animal," or "name." c. Using printf()'s %s format specifier,...
3. Create a program which allows the user to swap individual words in an input string....
3. Create a program which allows the user to swap individual words in an input string. Given a string of input, your program should count and store the number of words in a 2D array. The user can then select the index of the words they want to swap. Your program should swap those two words and then print the entire string to ouput. • Use string prompt "> ". • Use indices prompt "Enter two indices: ". • Remove...
Create a function in MIPS using MARS to determine whether a user input string is a...
Create a function in MIPS using MARS to determine whether a user input string is a palindrome or not. Assume that the function is not part of the same program that is calling it. This means it would not have access to your .data segment in the function, so you need to send and receive information from the function itself. The program should be as simple as possible while still using necessary procedures. Follow the instructions below carefully. Instructions: ●...