t298.py 262 B

12345678910111213141516
  1. # Test the behaviour of sets
  2. l = [1,2,3,4,1,1]
  3. print l
  4. s = set(l)
  5. print s
  6. # Test the addition and removal of items of a clone set
  7. t = set(s)
  8. print len(t), t
  9. print len(s), s
  10. t.add(100)
  11. print len(t), t
  12. print len(s), s
  13. t.discard(2)
  14. print len(t), t
  15. print len(s), s