Srinivas Iyyer wrote: > I want to find such instances of jack and jill's that > fall in the same ranges and they should be in opposite > to each other. > > Truely, I always flunk and my mind gets blackedout > when I see these number ranges. I do not know how to > write : check "if a range of numbers fall in the other > range of numbers" condition.
You might be interested in the interval module available here: http://members.cox.net/apoco/interval/ It implements Interval and IntervalSet. It seems to use a brute-force algorithm but at least it gives you a tested and packaged starting point. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor