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!")
Created at: 2020/04/20 16:33; Updated at: 2020/04/20 17:00