isdisjoint() method for set

isdisjoint(set) takes one set ( any iterable ) as argument .

set : set to checked
While checking we can use iterable objects like string , list etc Returns : True or False
isdisjoint False
A={'x','y','z'}
B={'x','b','c'}
print(A.isdisjoint(B))
Output ( 'x' is the common element among two sets A and B )
False
isdisjoint True
A={'x','y','z'}
B={'a','b','c'}
print(A.isdisjoint(B))
Output ( There is no common element among two sets A and B )
True

Using stirng

String is an iterable objects
A={'x','y','z'}
B='Alex'
print(A.isdisjoint(B))
Outut ( here x is the common element )
False

Using list

List is an iterable objects
A={'x','y','z'}
B=['a','b','c']
print(A.isdisjoint(B))
Output (No common elements )
True
All set methods Questions with solutions on set issubset() issuperset()
Subscribe to our YouTube Channel here



plus2net.com







Python Video Tutorials
Python SQLite Video Tutorials
Python MySQL Video Tutorials
Python Tkinter Video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer