Last active
June 12, 2020 16:53
-
-
Save bogardpd/c584b8776de56319e1bad6798f7c1543 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
output = "" | |
bottles = 99 | |
def bottle_str(bottles): | |
if bottles == 0: | |
return "No bottles" | |
elif bottles == 1: | |
return "1 bottle" | |
else: | |
return f"{bottles} bottles" | |
while bottles > 0: | |
output += f"{bottle_str(bottles)} of beer on the wall\n" | |
output += f"{bottle_str(bottles)} of beer\n" | |
output += f"Take one down, pass it around\n" | |
bottles = bottles - 1 | |
output += f"{bottle_str(bottles)} of beer on the wall\n\n" | |
f = open("99-bottles.txt", "w") | |
f.write(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment