how to the get the index() next closest code example Example: how to get index of closest value in list python min(range(len(a)), key=lambda i: abs(a[i]-11.5))