Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #99 bottles of beer
- #in python using a single recursive
- #function.
- def song(n):
- if n >= 2:
- while n > 2:
- print str(n), "bottles of beer on the wall!"
- print str(n), "bottles of beer!"
- print "take one down pass it around"
- print str(n - 1), "more bottles of beer on the wall!\n"
- return song(n - 1)
- print str(n - 1), "bottle of beer on the wall!"
- print str(n - 1), "bottle of beer!"
- print "take one down pass it around"
- print "no more bottles of beer on the wall!"
- if __name__ == '__main__':
- song(99)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement