Collaps arrays/ list of intergers

Denis McMahon denismfmcmahon at gmail.com
Tue Aug 19 15:05:17 EDT 2014


On Tue, 19 Aug 2014 05:54:24 -0700, Jurgens de Bruin wrote:

> I do hope somebody can help me with the following:
> I have the followings lists which represent the upper and lower value of
> a range/array.
> 
> a = [1,50]
> b = [75,150]
> c = [25,42]
> d = [120,149]
> e = [35,55]

I think you're starting off with the wrong data model.

I think you should be starting with is a list of either tuples or lists, 
eg:

[(1,50),(75,150),(25,42),(120,149),(35,55)]

and looking to output another list of tuples or lists, eg:

[(1,55),(75,150)]

I have a solution, but I don't consider it particularly elegant. :(

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list