set intersection : Set « Data Structure « Python






set intersection

set intersection
 
import sets

magic_chars = sets.Set('abracadabra')

poppins_chars = sets.Set('supercalifragilisticexpialidocious')

print ''.join(magic_chars & poppins_chars)    



           
         
  








Related examples in the same category

1.Make 2 sets out of sequences: Intersection, Union, Difference
2.Use set to key vowelsUse set to key vowels