Python set isdisjoint() method
Check whether two sets have no items in common.
Syntax
set.isdisjoint(other)
Parameters
| other | the other set |
Return value
bool
Example
Code
print({1, 2}.isdisjoint({3, 4}), {1, 2}.isdisjoint({2, 3}))
Output
True False
Related
Learn it step by step in the free lesson Dictionaries & Sets, with exercises that check your answers.