Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python programming. Write a program with a for-loop (MUST BE FOR-LOOP) that sings (i.e. prints) the North American road trip song, 99 Bottles of Beer

Python programming.

Write a program with a for-loop (MUST BE FOR-LOOP) that sings (i.e. prints) the North American road trip song, 99 Bottles of Beer (Links to an external site.)Links to an external site..

Depending on how long the road trip is, students (i.e. users), must decide how many bottles of beer to start with. So the program should ask for that input. If the user indicates that they wish to stop, the program should end with a nice message. Otherwise the program should then proceed to output lyrics from the song until there are no more bottles of beer on the wall.

sample output:

How many bottles of beer on the wall? -5 Sorry, that's not a valid number of bottles. Try again. How many bottles of beer on the wall? 5 OK, here we go! 
5 bottles of beer on the wall, 5 bottles of beer. Take one down, pass it around, 4 bottles of beer on the wall. 4 bottles of beer on the wall, 4 bottles of beer. Take one down, pass it around, 3 bottles of beer on the wall. 3 bottles of beer on the wall, 3 bottles of beer. Take one down, pass it around, 2 bottles of beer on the wall. 2 bottles of beer on the wall, 2 bottles of beer. Take one down, pass it around, 1 bottle of beer on the wall. 1 bottle of beer on the wall, 1 bottle of beer. Take it down, pass it around, no more bottles of beer on the wall! 

another sample output:

How many bottles of beer on the wall? End Goodnight, let's play again later. 

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

1. Identify what positions are included in the plan.

Answered: 1 week ago

Question

2. Identify the employees who are included in the plan.

Answered: 1 week ago

Question

7. Discuss the implications of a skill-based pay plan for training.

Answered: 1 week ago