generate functionTue, 23 May 2023
create a function of a set of integers and a value for which you need to find the nearest one.
def find_nearest(arr, target): return min(arr, key=lambda x: abs(x-target)) find_nearest([1,2,3,4,5], 7)
Python
Generate More