Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a program that calculates and displays the lyrics of the song Ninety-nine

ID: 3639215 • Letter: D

Question

Design a program that calculates and displays the lyrics of the song Ninety-nine nottles of beer on the wall.

1)Input the starting number of beers
2)Validate the number of starting beers to the range 10-110

3)Print the lyrics of the song as part of a 'for loop'.

4)If the number of bottles is 24,48,72,or 96 modify the lyrics so that it identifies the number of cases. For example, if there are 72 bottles, the lyrics would be:
"3 cases of beer on the wall
72 bottles of beer
Take one down and pass it around
Now there are 71 bottle of beer on the wall"

Explanation / Answer

Here is your program for Ninety-nine nottles. Written for python 2. Please take care of formatting while copying as formatting of program is important in python.

def print_song(bottle_count):
for i in range(bottle_count, 0, -1):
if i in [24, 48, 72, 96]:
print i/24, "cases of beer on the wall"
else:
print i, "bottles of beer on the wall,"
print i, "bottle of beer."
print "Take one down and pass it around,"
print "Now there are", i - 1, "bottles of beer on the wall."


if __name__ == '__main__':
bottle_count = int(raw_input("Starting number of bottles on beers: "))
if bottle_count < 10 or bottle_count > 110:
print "Please give bottle count between 10 and 110."
exit()
print_song(bottle_count)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote