generate functionTue, 23 May 2023
def nearest_value(values: set[int], one: int) -> int:
def nearest_value(values: set[int], one: int) -> int: return min(values, key=lambda x: (abs(x - one), x)) nearest_value({4, 7, 10, 11, 12, 17}, 9)
Python
Generate More