python: singular

Add a reply

Posted by flying sheep 722 days ago:
i am getting angry on the “s” of “bottles”, which has to be missing when there is only one bottle.
has anybody an idea how to get it done with few bytes lost?

it costs me 24 bytes!
Posted by eyepopslikeamosquito 716 days ago:
" bottle"+"s of beer"[expr:]

where expr is an expression evaluating to zero or one.
Posted by jackdied 498 days ago:
's'[2 - bottles_on_the_wall:]
assert '' == 's'[2-1:]
assert 's' == 's'[2-2:]
..
assert 's' == 's'[2-99:]

Add a reply