re: Challenge: Get Closest Number in an Array VIEW POST

VIEW FULL DISCUSSION
 

Here goes Python !

min(nums, key=lambda x: abs(x - given_num))
code of conduct - report abuse