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.add(one) l = sorted(values) return l[l.index(one) - 1] if l.index(one) > 0 else l[l.index(one) + 1]

Questions about programming?Chat with your personal AI assistant