Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getIntersection(set_item1, set_item2):
- (l11, l12) = set_item1
- (l21, l22) = set_item2
- if (l11 > l21 and l11 < l22) or (l12 > l21 and l12 < l22) or (l21 > l11 and l21 < l12) or (l22 > l11 and l22 < l12):
- if l11 > l21:
- start = l11
- else: start = l21
- if l12 > l22:
- end = l22
- else:
- end = l12
- return (start ,end)
- return None
- def returnInersection(set1, set2):
- for l1 in set1:
- for l2 in set2:
- ret = getIntersection(l1, l2)
- if ret:
- print ret
Add Comment
Please, Sign In to add comment