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: m = min(values, key=lambda x: abs(x - one)) if m in values: return m return None nearest_value({4, 7, 10, 11, 12, 17}, 9)

Questions about programming?Chat with your personal AI assistant