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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started