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