logoalt Hacker News

remram01/22/20252 repliesview on HN

> 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)


Replies

antiframe01/22/2025

But the whole point is that "0 result" is not correct but "0 results" is.

show 1 reply
DonHopkins01/22/2025

That makes -infinity ... -1 singular too.