python nearest value in list code example
Example: python get nearest value in list
def takeClosest(num,collection):
return min(collection,key=lambda x:abs(x-num))
def takeClosest(num,collection):
return min(collection,key=lambda x:abs(x-num))