Finding if the next element is smaller than the one before it and deleting it from the list python
<p>I am having trouble with my code, I am writing a method that will check if the next element is smaller than the previous element and if it is, it will delete it.</p>

<p>Example:</p>

<p>Input: <code>[1, 20, 10, 30]</code></p>

<p>Desired output:  <code>[1,20,30]</code></p>

<p>Actual output: <code>[30]</code></p>

<pre><code>def findSmaller(s):
    i = -1
    y = []
    while i &lt;= len(s):
        for j in range(len(s)):
            if s[i+1] &lt;= s[i]:
                del s[i + 1]
                y.append(s[i])
            i += 1
            return y
</code></pre>