Python

Python Menu

Python

Python Set isdisjoint() - Definition, Syntax, Parameters, Examples

Definition

The isdisjoint() method returns True if none of the items are present in both sets, otherwise it returns False.

Syntax

set.isdisjoint(set)

Parameters

Parameter Description
set Required. The set to search for equal items in

Examples:

persons1 = {"Mark", "Jeff", "Ivan", "Mike"} persons2 = {"Arnel", "Marie", "Sarah", "Alex"} j = persons1.isdisjoint(persons2) print(j)
# example with an item present in both sets persons1 = {"Mark", "Jeff", "Ivan", "Mike"} persons2 = {"Arnel", "Marie", "Ivan", "Alex"} k = persons1.isdisjoint(persons2) print(k)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods