Answers for "python closest to value in list"

0

python get nearest value in list

def takeClosest(num,collection):
   return min(collection,key=lambda x:abs(x-num))
Posted by: Guest on March-27-2021
0

how to get index of closest value in list python

min(range(len(a)), key=lambda i: abs(a[i]-11.5))
Posted by: Guest on July-12-2020

Code answers related to "python closest to value in list"

Python Answers by Framework

Browse Popular Code Answers by Language