disjoint set python

Solutions on MaxInterview for disjoint set python by the best coders in the world

showing results for - "disjoint set python"
Christina
17 Jan 2016
1# Python3 program for isdisjoint() function
2  
3set1 = {2, 4, 5, 6} 
4set2 = {7, 8, 9, 10}
5set3 = {1, 2}
6  
7  
8#checking of disjoint of two sets
9print("set1 and set2 are disjoint?", set1.isdisjoint(set2))
10  
11print("set1 and set3 are disjoint?", set1.isdisjoint(set3))