![]() |
VOOZH | about |
Python set isdisjoint() function check whether the two sets are disjoint or not, if it is disjoint then it returns True otherwise it will return False. Two sets are said to be disjoint when their intersection is null.
Syntax: set1.isdisjoint(set2)
Parameters:
- another set to compare with
or- an iterable (list, tuple, dictionary, and string)
Return: bool
Output:
True
Output:
set1 and set2 are disjoint? True set1 and set3 are disjoint? False
Output:
Set A and List lis disjoint? False Set A and dict are disjoint? False Set A and dict2 are disjoint? True
Here we will see what will be the output if we use the isdisjoint() method with two sets both are empty.
True