Removing an element in a list if it is the same as the previous element
<p>I've been stuck on this for a while now. It sounds simple enough but here's the code I've been working with so far. Basically the function is passed a bunch of numbers in a list for example <code>a_list = [1,2,3,3,4,3]</code> and I should get <code>[1,2,3,4,3]</code></p>
<pre><code>def remove_doubles(a_list):
    print()
    new_list = []
    for i in range(len(a_list)):
        if a_list[i] != a_list[i+1]:  
            new_list.append(a_list[i])
        return new_list
</code></pre>