python find index of closest value in list 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))