Hello ,I want to find between what numbers of a list exist a specific number:
For example if i enter 15,i should be between 13 and 21.
list = [1,5,9,11,13,21,27,29,32]
for index in range(len(list)):
if num > list[index] and num < list[index + 1]:
...............................................
But with this code when i get to the last element of the list you get the error: list index out of range,because of the list[index + 1]
Any other way to do this ?