I\'m refactoring a function that, given a series of endpoints that implicitly define intervals, checks if a number is included in the interval, and then return a correspondi
Another way ...
def which(lst, p): return len([1 for el in lst if p > el]) lst = [100, 300, 500, 800, 1000] which(lst, 2) which(lst, 101) which(lst, 1001)