• Problem Nearest Value

 

Why not cheking?

def nearestvalue(values: set, one: int) -> int: cheklist = [abs(one - el) for el in values] resultindex, result = cheklist.index(min(cheklist)), list(values) return result[resultindex]

if name == 'main': print("Example:") assert nearest_value({-1, 2, 3}, 0) == -1 print("Coding complete? Click 'Check' to earn cool rewards!")