title: Can anybody explain the Logic behind the min([1,2,3,5,6], key=lambda x: abs(x-8))
body: <p>This is my list: <code>a = [1, 3, 4, 7, 8, 9, 12, 13, 14]</code>.</p>
  
  <p>I want to get the number that is closest to <code>5</code>, this is the solution:</p>
  
  <pre><code>b = min(a, key = lambda x: abs(x-5))
  </code></pre>
  
  <p>Please explain what is happening in the above line.</p>