t297.py 180 B

1234567891011
  1. # Test the behaviour of sets
  2. l = [1,2,3,4,1,1]
  3. print l
  4. s = set(l)
  5. # Test the addition and removal of items
  6. print len(s), s
  7. s.add(100)
  8. print len(s), s
  9. s.discard(2)
  10. print len(s), s