Determines whether or not two sets have any items in common
Usage
The isdisjoint()
method returns True if two sets have no items in common, otherwise FALSE.
Sets are disjoint if and only if their intersection is the empty set.
Syntax
set.isdisjoint(set)
Parameter | Condition | Description |
set | Required | A set to search for common items in |
Examples
# Check if two sets have no items in common
A = {'green', 'blue', 'purple'}
B = {'yellow', 'red', 'orange'}
print(A.isdisjoint(B))
# Prints True

The method returns FALSE if the specified sets have any item in common.
A = {'red', 'green', 'blue'}
B = {'yellow', 'red', 'orange'}
print(A.isdisjoint(B))
# Prints False