Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardPythonidentity vs equalitySingle-choice MCQ

Why does the second membership test print `False` even though both objects compare equal to nothing (NaN), revealing the order CPython uses inside the `in` operator?

nan = float('nan') s = {nan} print(nan in s) # ? print(float('nan') in s) # ?