What is isdisjoint method in sets | How to use isdisjoint method of sets.

Definition

This method returns true if two set has no common items, else it returns false. Since, it returns a value therefore original set remains unchanged.

Syntax

Variable = A.isdisjoint(B)

This method takes argument

Working

What is isdisjoint method in sets

How to use isdisjoint method of sets

Code

  1. Set A is being taken
  2. Set B is being taken
  3. isdisjoint() method is being applied to set A with the help of set B
  4. Returned value is printed inside C

Output

  1. Output is True. Since both sets has no common items.

Interview Questions

  • How will you find if two sets are completely distinct?

We can find if two sets are completely distinct or not by using isdisjoint() method.

Quick Links:

What is a list in python, How to use list and its methods?

Different types of collection data types in python.

Waqar Khan

Hello, everyone, I am Waqar Khan. I have done my B.tech in Computer Science. I love to write about Computer Informational blogs. Before write I did proper research on it. Hope you like our blogs. Thank you.

Related Posts

Leave a Reply

Your email address will not be published.