set : set to checked
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
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
A={'x','y','z'}
B='Alex'
print(A.isdisjoint(B))
Outut ( here x is the common element )
False
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()
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.