On Tue, 19 Aug 2014 05:54:24 -0700 (PDT), 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] > > What I would like to happen is that overlapping range will "collapse" > to a single range meaning the above list would become: > > as list a,c and e overlap they can be represented by > f = [1,55] > as list b and d overlap they can be represented by > g = [75,150]
Is your question about (a) identifying overlapping subsets of ranges, or (b) collapsing such subsets once you have identified them? What output would you want if the inputs were . . . a = [1,50] b = [2,10] c = [40,60] ? -- To email me, substitute nowhere->spamcop, invalid->net. -- https://mail.python.org/mailman/listinfo/python-list