Advertisement
Guest User

Beer on the wall

a guest
Nov 21st, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #! -*- coding: utf-8 -*-
  2.  
  3. def sing(self):
  4. bottles = reversed(range(100))
  5. for i in bottles:
  6. if i > 1:
  7. a = ""
  8. a += str(i) + " bottles of beer on the wall, " + str(i) + " bottles of beer."
  9. a += "\n" + "Take one down, pass it around you've got " + str(i-1) + " bottles of beer on the wall"
  10. print(a) # TODO: Maybe add a linebreak after 'a' to separate the verses
  11. print "\n"
  12. elif i > 0:
  13. b = ""
  14. b += "1 more bottle of beer on the wall, 1 more bottle of beer."
  15. b += "\n" + "Take one down, pass it around you've got no more bottles of beer on the wall"
  16. print b
  17. print "\n"
  18. else:
  19. c = ""
  20. c += "No more bottles of beer on the wall, no more bottles of beer."
  21. c += "\n" + "Go to the store, buy some more, 99 bottles of beer on the wall."
  22. print c
  23. break
  24.  
  25.  
  26. if __name__ == '__main__':
  27. song = BottlesOfBeer()
  28. song.sing()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement