How to find the smallest closest number in a list in python
<p>I want to know how can I find the smallest closest number in a list to a given number. 
For example:</p>

<pre><code>number = 20

list_of_numbers = [4, 9, 15, 25]
</code></pre>

<p>I tried this:</p>

<pre><code>min(list_of_numbers, key=lambda x:abs(x-number))
</code></pre>

<p>The output is 25 and not 15. The problem is that it always gives me the "biggest closest" and not the "smallest closest". </p>