Find surrounding elements in a list in python
<p>I want to find the two elements surrounding an element in a list. I propose this code (it works) but I am pretty sure there is a way to do this in an easier way. </p>

<pre><code>a = [4,5,6,8,9,15,16,18,54,60]
b = 24

i = 0
while i&lt;len(a):
    if b &gt; a[i-1] and b &lt; a[i+1]:
        result = [a[i-1],a[i]]
        i = i+1
    else:
        i = i+1
</code></pre>

<p>It returns me: </p>

<pre><code>&gt;&gt;&gt; result
[18, 54]
</code></pre>

<p>Do you know the python function?</p>