Hacker News new | ask | show | jobs
by remram 515 days ago
> f"{n} result{'s' if n == 1 else ''}"

n>1 is even shorter than n!=1

(also you wrote == instead of != your code is backwards)

2 comments

But the whole point is that "0 result" is not correct but "0 results" is.
The question is why is "0 results" correct. hyrix's answer is so that you have a simple equation for plural, my response is that if "0 result" was correct we would have an even simpler equation.
That makes -infinity ... -1 singular too.