Here's my solution:
def inside_interval(num, interval):
start, end = interval.split(sep='-')
return num in range(int(start), int(end))
And some sample output:
intervals = ['132-237', '156-223', '589-605']
print(inside_interval(150, intervals[0]))
print(inside_interval(123, intervals[1]))
print(inside_interval(600, intervals[2]))
# True, False, True
Here's using the example with a for loop (in a list comprehension). You could use another construct here if you really wanted to, but you'd need a good reason to do so.
num = 160
intervals_list = [inside_interval(num, interval) for interval in intervals]
# intervals_list = [True, True, False]
This gets you an output of Booleans that correspond to your list of intervals.
I'd personally suggest that you turn your intervals into a more useful format, rather than using strings. That will make it easier to do other comparisons.