It is used to represent a group of values without duplicates, where order is not important then set data Type is used.
- Insertion order is not preserved.
- Index concept is not applicable.
- Heterogeneous objects are allowed.
- Duplicates are not allowed.
- Growable in nature.
- It is mutable collection.
Example:
s={100,0,10,300,50,’Webnoid’}
s#{0,100,’Webnoid’,300,10}
s[0]==>TypeError: ‘set’ object does not support indexing
set is growable in nature, based on our requirement we can increase or decrease the size.
>>>s,add(60)
>>>s
{0,100,’Webnoid’,300,10,60}
>>>s.remove(100)
>>>s
{0,’Webnoid’,300,10,60}