I have been studying different ways of manipulating lists for awhile now and I have encountered a problem that my inexperienced self cannot seem to solve.
Consider the list a = [1,0,1,0,1,1,0]
.
I want to push all occurrences of 1
s to the left making the list a = [1,1,1,1,0,0,0]
.
Is there some function out there I could call that I am not aware of, or do I have to do this manually? I want to iterate through the list one by one but I feel like it wouldn't be efficient.