I'm trying to write a code in python that can remove overlapping lists. My lists are in the format [lower_bound,upper_bound,data,data]. These lists are stored in a larger list. I want to iterate over the larger list, removing any of these smaller lists where the bounds overlap. This is what I have. def cut_overlapping_ranges(ranges): keep_ranges = [] temp_ranges = ranges for range_1 in temp_ranges: keep_ranges.append(range_1) for range_2 in temp_ranges: if range_1 != range_2: if ((range_1[0] < range_2[0] < range_1[1]) or (range_1[0] < range_2[1] < range_1[1])): temp_ranges.remove(range_2) return Is there a good way to do this? outputs only the first list, deletes all others. Continue reading...