If we want to represent a group of values without duplicates where order is not important, then we should go for set Data Type.
1. insertion order is not preserved
2. duplicates are not allowed
3. heterogeneous objects are allowed
4. index concept is not applicable
5. It is mutable collection
6. Growable in nature
Example:
1) s=(100,0,10,200,10,'siddu')# (0, 100, 'siddu', 200, 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, 'siddu', 200, 10, 60)
>>> s.remove(100)
>>> s#(0, 'siddu', 200, 10, 60)
No comments:
Post a Comment
Thank you Very Much.For Given Comment