Skip to content

Instantly share code, notes, and snippets.

@grejppi
Last active January 4, 2016 01:09
Show Gist options
  • Save grejppi/8546257 to your computer and use it in GitHub Desktop.
Save grejppi/8546257 to your computer and use it in GitHub Desktop.
99 Bottles of Beer oneliner
print('\n'.join(((lambda i:(lambda v:v[0].capitalize()+v[1:])(', {1}\n{0}, {2} '.join(('on the wall',)*2).join(('{1} ','.\n')).format('Take one down, pass it around' if i!=0 else 'Go to the store and buy some more',*('{0} bottle{1} of beer'.format((str.replace if s in range(11,20) else lambda a,b,c:a)(*('}{'.join((str(w) for w in l)).join(('{','}')) for l in ((0,1,2,3,),)*2+((3,1),))).format((('',)*2+('twen','thir','for','fif','six','seven','eigh','nine'))[(s-(s%10))//10],'' if s<13 else 't'+('y' if s>19 else 'een'),'ten' if s==10 else ('-' if s%10!=0 and s>10 else ''),('','one' if s!=11 else 'eleven','tw'+('o' if s!=12 else 'elve'),'th'+('ree' if s!=13 else 'ir'),'four','fi'+('ve' if s!=15 else 'f'),'six','seven','eigh'+('t' if s!=18 else ''),'nine')[s%10] if s!=0 else 'zero'),'s' if s!=1 else '') for s in (i%100,(i-1)%100)))))(i) for i in reversed(range(100)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment