1

How can I compare the numbers of multiple lists to test if there is no overlap in the number ranges across all lists.

a = [1, 8]
b = [9, 13]
c = [14, 20]

I want to know if the numbers in the lists overlap with each other.

  • 1
    To clarify, in your example there would be no overlap with `a`, `b`, and `c`, right? – gen_Eric Mar 08 '21 at 18:39
  • 1
    If you are working with "ranges" of numbers, you may want to look into `range()`. – gen_Eric Mar 08 '21 at 18:41
  • That's correct no overlap with a, b and c. I'm not sure how to compare range (a) to range (b) and range (c). – Terry Phillips Mar 08 '21 at 19:30
  • 1
    See if these help: [How to find range overlap in python?](https://stackoverflow.com/q/6821156/4518341) and [How to get all possible combinations of a list’s elements?](https://stackoverflow.com/q/464864/4518341) (combining `a`, `b`, and `c`, that is) – wjandrea Mar 08 '21 at 20:04
  • Yep, I was able to get the solution from the How to find range overlap in python? Thanks!! – Terry Phillips Mar 09 '21 at 23:30

0 Answers0