[Tutor] Please help with comparision in range of numbers

Kent Johnson kent37 at tds.net
Fri Sep 16 13:58:41 CEST 2005

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:

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.


More information about the Tutor mailing list