import random l = [20, 40, 60, 80, 100] y = 88 if y>0 and y<=l[0]: print("in range 0-20") for i in range(1,len(l)-1): if y>l[i] and y<=l[i+1]: print(i)