Guest User

Untitled

a guest
Oct 20th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. def getIntersection(set_item1, set_item2):
  2. (l11, l12) = set_item1
  3. (l21, l22) = set_item2
  4. if (l11 > l21 and l11 < l22) or (l12 > l21 and l12 < l22) or (l21 > l11 and l21 < l12) or (l22 > l11 and l22 < l12):
  5. if l11 > l21:
  6. start = l11
  7. else: start = l21
  8.  
  9. if l12 > l22:
  10. end = l22
  11. else:
  12. end = l12
  13. return (start ,end)
  14. return None
  15.  
  16. def returnInersection(set1, set2):
  17. for l1 in set1:
  18. for l2 in set2:
  19. ret = getIntersection(l1, l2)
  20. if ret:
  21. print ret
Add Comment
Please, Sign In to add comment