It is a method in python that checks if the given sets has no element in common between them. Hence it returns True if the set is disjoint else False. Two disjoint sets has no elements in common between them. It doesn’t modifies the given set and it takes single parameter in the argument.
Syntax:
set1.isdisjoint(set2)
Also Read: Python Set – copy() Method
Example 1:
# Python code to understand isdisjoint() method in set
# www.codewindow.in
s1 = {2, 5, 8, 7, 9}
s2 = {10, 18, 14}
s = {10, 5, 2}
#disjoint of s and s1
print(s.isdisjoint(s1))
#disjoint of s1 and s2
print(s1.isdisjoint(s2))
Output:
False
True
Explanation:
Here, it returned False as set s and s1 has elements common (2, 5) in them. The next one it’s True as set s1 and s2 has no elements common in them.
Example 2:
# Python code to understand isdisjoint() method in set
# www.codewindow.in
s1 = {"code", "window"}
s = {"code", "website"}
s2 = {"tech", "website"}
#disjoint of s and s1?
print(s1.isdisjoint(s))
print(s1.isdisjoint(s2))
Output:
False
True
Explanation:
Here, it returned False as set s and s1 has elements common (“code”) in them. The next one it’s True as set s1 and s2 has no elements common in them.
Follow Us
You Missed
- UKG Hiring for Software Engineer
- Unlocking Innovation and Diversity: Accenture HackDiva Empowers Women in Tech with Cutting-Edge Solutions – codewindow.in
- QA Engineer Opportunities at Siemens Company: Apply Now – codewindow.in
- Transform Your Career with S&P Global: Apply for the Software Development Engineer Role and Lead the Future of Financial Technology Innovation – codewindow.in
- Unlock Your Potential at Accenture as an Associate Software Engineer – Elevate Your Career with Innovation and Excellence – codewindow.in
- Accelerate Your Career: Join NVIDIA’s Elite Software Engineering Internship Program and Shape the Future of Technology – codewindow.in
- Software Engineer at ABB: Unlock Innovation and Shape the Future – codewindow.in
- IBM Associate Systems Engineer Job: Boost Your Career with a Leading Technology Giant – codewindow.in
- Start Your IT Career Journey with Amazon: IT Services Support Associate I Opportunity – codewindow.in
- Shape the Future of Web: Front-End Software Engineer Opportunity at Google Cloud – codewindow.in
- Exciting Opportunity: Java Spring Boot Senior Developer Role at Infosys – codewindow.in
- Unlock Your Potential at Nokia: Software Engineer Opportunities Await – codewindow.in
- Join Microsoft’s World-Class Team as a Software Engineer and Shape the Future of Technology – codewindow.in
- Virtusa is Seeking Talented React JS Developers to Drive Digital Excellence – codewindow.in
- Join IBM Dynamic Team as a Full Stack Developer and Shape the Future – codewindow.in
- EY Welcomes Aspiring AI/ML Interns to Unlock the Future of -codewindow.in
- Wipro is Hiring Test Engineers to Elevate Quality Assurance – codewindow.in
- Deloitte Is Hiring: Analysts and Senior Analysts Wanted to Drive Innovation – codewindow.in
- Exciting Software Development Opportunity At Oracle – codewindow.in
- PayPal Hiring Data Analyst 1 – codewindow.in
- SIEMENS HEALTHINEERS Hiring Data Scientist ( ML & AI) – codewindow.in
- Programming in C++ – codewindow.in
- Programming in C++ – codewindow.in
- Unstop Hiring Challenges Internships and Hackathons – codewindow.in
- Programming in Python – codewindow.in
- Programming in Python – codewindow.in
- Programming in C++ – codewindow.in
- Programming in C++ – codewindow.in
- Programming in C++ – codewindow.in
- Programming in C++ – codewindow.in
- Programming in C++ – codewindow.in
- Data Structure – comprehensive guide – codewindow.in
Also Checkout
- Adobe
- Advanced Coading
- Advanced course
- Ajax
- Algorithm
- Angular JS
- Aptitude
- Aptitude tricks
- Automata Fixing
- big data
- Books
- Bridge2i
- C programming
- Capgemini Coding Questions
- Capgemini Pseudocode
- Cloud Computing
- code nation
- Coding Questions
- Cognizant Placement
- commvault Systems
- Computer Network
- CSS
- Data Science
- Data Structure
- Data Structure and Algorithm
- DBMS
- deloitte
- Epam Full Question Paper
- Extempore
- Exxon Mobil interview questions
- filpkart
- Genpact
- Grab
- Group Discussion
- Guidance for Accenture
- Hackathon 2024
- Hexaware
- HR Questions
- HTML5
- IBM Questions
- Infosys
- Internship
- Interview Experience
- Interview Questions
- ITC Infotech
- itron
- JavaScript
- JECA
- Job Info
- JQuery
- Language Confusion
- language confussion
- Machine Learning
- Media.net
- Miscellaneous
- Mock Test Series
- MongoDB
- nagarro
- navi
- NodeJS
- Operating System
- Optum
- PayU
- PHP and MYSQL
- Programming in C
- Programming in C++
- Programming in JAVA
- Programming in Python
- Pseudo Code
- pseudocode
- Python
- Quiz
- ReactJS
- Recruiting Companies
- Revature
- salesforce
- Samsung
- Schlumberger
- Seimens
- Software Engineering
- Study Material
- tata cliq
- TCS
- TCS NQT
- TCS NQT Coding Questions
- Tech Mahindra Coding Questions
- Tech Mahindra Questions
- Technical Preparation
- Teg Analytics
- Tiger Analytics
- Uncategorized
- UnDosTres
- Unstop
- Verbal Ability
- Verbal Lesson
- Web Development
- wipro
- Wipro Coding Questions
- Wipro NLTH
- WIpro NLTH Coding Solve