Sets in Python is unordered collection of unique elements whereas list in Python is ordered list of colleciton which can contain duplicate elements.
In [1]:
a = {200,100,10,20}
b = {10,30,40,38}
Another way is to use the keyword Set as shown below.
In [2]:
set([200,100,10,20])
Out[2]:
In [3]:
a.issubset(b)
Out[3]:
In [4]:
a & b
Out[4]:
In [5]:
a | b
Out[5]:
In [6]:
a - b
Out[6]:
The symmetric difference of two sets a and b is the set (a – b) Union (b – a).
In [7]:
a ^ b
Out[7]: