Python Set isdisjoint() Method Tutorial

In this section, we will learn what the Set isdisjoint() method is and how to use it in Python.

What is Set isdisjoint() Method in Python?

The Python Set isdisjoint() method is used to see if two Set objects have no common element.

Python Set isdisjoint() Method Syntax:


Set isdisjoint() Method Parameter:

The method takes one argument and that is a reference to a Set object that we want to compare its elements with the Set object that this method is invoked with.

Set isdisjoint() method Return Value

The return value of this method is of type Boolean.

The value True will return if there’s no common element (not even a single common element) in both Set objects. Otherwise the value False will return.

Example: using python set isdisjoint() method

set1 = {"Ellen","Jack","Omid"}

set2 = {"Elon","John","Ian"}

result = set1.isdisjoint(set2)




Leave a Reply