Advertisement
Guest User

Bottle of Beer

a guest
Apr 6th, 2020
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1. bobotw = " bottles of beer on the wall"
  2. bob = " bottles of beer."
  3. take = "Take one down and pass it around, "
  4. beer = 99
  5.  
  6. def on_wall(beer):
  7.     while beer >= 0:
  8.         if beer == 0:
  9.             print("No more" + bobotw + ", no more" + bob)
  10.             print("Go to the store and buy some more, 99" + bobotw + ".")
  11.             return
  12.         elif beer == 1:
  13.             print(str(beer) + " bottle of beer on the wall, " + str(beer) + " bottle of beer.")
  14.             beer -= 1
  15.             print(take + "no more" + bobotw + ".")
  16.         elif beer == 2:
  17.             print(str(beer) + bobotw + ", " + str(beer) + bob)
  18.             beer -= 1
  19.             print(take + "only one bottle of beer on the wall.")
  20.         else:
  21.             print(str(beer) + bobotw + ", " + str(beer) + bob)
  22.             beer -= 1
  23.             print(take + str(beer) + bobotw + ".")
  24.  
  25. answer = input("Do you want to see the Bottles of Beer song? (y/n) : ")
  26.  
  27. if answer.lower() == "y":
  28.     on_wall(beer)
  29. elif answer.lower() == "n":
  30.     print("Bollocks to ya then.")
  31. else:
  32.     print("It's y for yes, n for no.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement