On Fri, Jan 31, 2014 at 7:08 AM, Dave Angel <da...@davea.name> wrote: >> 'You have scored %i point%s' % (score, 's'*(score != 1)) >> > > Here I'd probably do something like > > 'You have scored {} {}' .format (score, 'point' if score==1 else > 'points')
Bah, what's the fun in that? 'You have scored %i point%.*s' % (score, score!=1, 's') BTW, the layout of the original bugs me slightly: >> 'You have scored %i point%s' % (score, 's'*(score != 1)) I don't like having spaces around != and none around *. I'd either squash the != up or space out the *: 'You have scored %i point%s' % (score, 's'*(score!=1)) 'You have scored %i point%s' % (score, 's' * (score != 1)) Operators should always have at least as much space around them as more tightly-binding operators, IMO. In this instance, it'd be reasonable to squash the != and space the *, or to squash both, or to space both, but not the "backward" spacing of the original :) But that's just my opinion. ChrisA -- https://mail.python.org/mailman/listinfo/python-list