Home >>Python Set Methods >Python Set isdisjoint() Method
Python Set isdisjoint() Method in python set takes only a single arguments. Generally, it returns true if the items are not present in both the sets, otherwise it returns False.
Syntax:set.isdisjoint(set)
Parameter | Description |
---|---|
set | Required. The set of items to be search for |
a = {"php", "python", "SQL"}
b = {"facebook", "instagram", "google+"}
c = a.isdisjoint(b)
print(c)
num1 = {23, 65, 12, 43}
num2 = {35, 76, 42, 10}
num3 = {23, 12}
print("num1 and num2 are disjoint?", num1.isdisjoint(num2))
print("num1 and num3 are disjoint?", num1.isdisjoint(num3))