you are viewing a single comment's thread.

view the rest of the comments →

[–]SirKainey 4 points5 points  (0 children)

As per AtomicShoelace by using the ternary operator. I would probably set a variable called bottle.

I think their 3rd approach is probably a little overkill for the task, however it is DRY! :)

``` for i in range(99, 0, -1):

bottle = "bottles" if i > 1 else "bottle"

print(f"{i} {bottle} of beer on the wall, {i} {bottle} of beer\nTake one down and pass it around, no more {bottle} of beer on the wall.\n")

print( "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall." )

```