Question: 7.9 REQUIRED - LAB 7A: Mad Lib - Loop Overview Extend the earlier mad lib program from chapter 1 to create multiple mad lib stories.

7.9 REQUIRED - LAB 7A: Mad Lib - Loop

Overview

Extend the earlier mad lib program from chapter 1 to create multiple mad lib stories.

Objective

Be able to implement a sentinel-controlled loop.

Description

Remember from Lab 1C that Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (and hopefully funny) ways.

Extend your program from Lab 1C that repeats asking the user for input and displaying the short story until the user wants to quit. Your input prompts should end with one space and no newline, ie,

name = input("Enter a name: ") 

At the end of each story, you will ask the user, 'Do you want to quit [y/n]?' If they say 'n', you should ask for another set of names and output another story. If they say 'y', your program should print 'Goodbye' and then end.

Note that when printing your story, it should be printed on two lines as shown in the examples below.

An example of an entire run is as follows:

Enter a name: Eric Enter a place: Lou & Harry's Enter a number: 12 Enter a plural noun: cars Enter an adjective: orange Eric went to Lou & Harry's to buy 12 different types of cars but unfortunately, the cars were all orange so Eric went back to Lou & Harry's to return them. Do you want to quit [y/n]? n Enter a name: Derek Enter a place: JoAnn Fabrics and Crafts Enter a number: 3 Enter a plural noun: sewing machines Enter an adjective: pretty Derek went to JoAnn Fabrics and Crafts to buy 3 different types of sewing machines but unfortunately, the sewing machines were all pretty so Derek went back to JoAnn Fabrics and Crafts to return them. Do you want to quit [y/n]? y Goodbye 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!