Advertisement
TristanSld

intersection and intersection_update methods in sets

Jan 11th, 2014
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. #usr/bin/env python
  2. #-*-coding:utf-8-*-
  3. a=set([1,8,12,20])
  4. b=set([1,3,12,22,30])
  5. print a.intersection(b) or a & b, "\n" #iki kümenin kesişim kümesini verir
  6. print a, " ", b, "\n"
  7. #.....
  8. a.intersection_update(b) # iki kümenin kesişim kümesini verir ve a kümesini günceller
  9. # veya
  10. a &= b # intersection_update yöntemi ile aynı işi görür
  11. #.....
  12. print a, " ", b, " "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement