for value in a1:
    index = bisect.bisect(a, value)
if index and isclose(a[index - 1], value):
    result.append(b[index - 1])
elif index < len(a) and isclose(a[index], value):
    result.append(b[index])
How to compare list in Python?