Question: Python programming. Write a program with a for-loop that sings (i.e. prints) the North American road trip song, 99 Bottles of Beer (Links to an

Python programming.

Write a program with a 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

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!