Cody Bable

Generation

generate functionTue, 23 May 2023

def nearest_value(values: set[int], one: int) -> int:

def nearest_value(values: set[int], one: int) -> int: values = set(values) values.remove(one) return min(values, key=lambda x: abs(x - one))

Questions about programming?Chat with your personal AI assistant