Problem

Mad LibsMad Libs (madlibs.com) is an old word game for children. (If you have never played...

Mad Libs

Mad Libs (madlibs.com) is an old word game for children. (If you have never played Mad Libs, try it at eduplace.com/tales/.) You are prompted for categories of words (color, girl’s name, place, etc.) and then those words are inserted into a predefined story. The predefined story has placeholders for those words that get replaced by the values prompted for. For example: Suppose you are prompted for a verb and a noun, and you respond with giggle and spark. If the predefined string was the first line of Hamlet in this form:

To VERB or not to VERB: that is the NOUN:

The revised version will be:

To giggle or not to giggle: that is the spark:

Create your own predefined story with parts of speech replaced with their description in all capitals: VERB, NOUN, ADJECTIVE, etc. Your story will be more interesting if you augment your words to be replaced with others appropriate for your story: BOYS_NAME, COLOR, ACTIVE_VERB, etc. Be creative. If you are at a loss for ideas, begin with a fairy tale. For example, here is the beginning of “Little Red Riding Hood” (note the backslash continuation character \):

story = "Once upon a time in the middle of a ADJECTIVE_ONE NOUN_ONE stood a \ ADJECTIVE_TWO NOUN_TWO, the home of a ADJECTIVE_ONE ADJECTIVE_THREE \ NOUN_THREE known to everyone as GIRLS_NAME."

Prompt the user for strings to replace the various parts ofspeech that you have specified. Print out the revised story.

Hint: the string method replace(old,new) will be helpful.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 4
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT