Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

4. What sales experience have you had?

Answered: 1 week ago