Sets : Set In : Data Structure PYTHON examples


PYTHON examples » Data Structure » Set In »

 

Sets


Sets: A set is an unordered collection with no duplicate elements



basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
fruit = set(basket)                     create a set without duplicates
print fruit

print 'orange' in fruit                 # fast membership testing

print 'crabgrass' in fruit


           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Data Structure
» Set In