isdisjoint() method for set

All set methods

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()


plus2net.com



Post your comments , suggestion , error , requirements etc here





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