Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
sorting elements first by distance, second by value solution in Clear category for Nearest Value by new_hoschi
import numpy
def nearest_value(values: set, one: int) -> int:
return sorted(values,key=lambda x: (abs(x-one),x))[0]
March 28, 2020
Comments: