Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

66%
+2 −0
Challenges 99 Shortened Bottles of Beer

Python 3, 202 bytes a,i='bottle%s of beer on the wall',99 while i:i-=1;x=a%'s'[:i];print(i+1,x+',',i+1,x[:-12]+'.\n'+'GToa kteo otnhee dsotwonr ea nadn dp absusy isto maer omuonrde,,'[i>0...

posted 2y ago by Endercraft2319‭

Answer
#1: Initial revision by user avatar Endercraft2319‭ · 2021-09-22T02:58:11Z (over 2 years ago)
# [Python 3], 202 bytes

<!-- language-all: lang-python -->

    a,i='bottle%s of beer on the wall',99
    while i:i-=1;x=a%'s'[:i];print(i+1,x+',',i+1,x[:-12]+'.\n'+'GToa kteo  otnhee  dsotwonr ea nadn dp absusy  isto maer omuonrde,,'[i>0::2],i or 99,a%'s'[:i!=1]+'.\n')

[Try it online!][TIO-ktux1uf0]

[Python 3]: https://docs.python.org/3/
[TIO-ktux1uf0]: https://tio.run/##NY6xTsNAEAV7vuJRRBvkDcKh8kVOmx@gMy7O8iKv4txavo2cfL0hCLopRpqZ7j5Yel/XyFpTZ@6jbDLsC53IDEvwQbDEcSSuqqdl0FGgQXd1ebjVcUOZmqDtYZo1@VaLkm8FMfEvNWFX7tuCXj8TFXT6sIiziwHmaRAB@my@WJohESn2Cf2E2OVrvgOa3XCJj4nL9cfphZkaPb6FsG9ZYTOqiv8PnuvyL/Syrt8 "Python 3 – Try It Online"