No. It says "only if", not something like "if only one".
"Return true if and only if there is such a pair" means you must return true if there is such a pair and you must return true only if there is such a pair. The latter part, the one you misunderstand, means you must not return true if there is no such pair. Without that, you could just write:
class Solution: def containsNearbyDuplicate(self, nums, k): return True
It's a standard term, there's even a wikipedia article about it.
In other words, instead of "return true if and only if there is such a pair" the problem could say "find out whether there is such a pair". That means the same thing (in the context of having to return a boolean) but might be easier to understand for people not used to "if and only if".
Thanks to your suggestion @pochmann! I have changed the problem description so it is easier to understand.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.