Iterative implementation of partitioning function

I learned : list.pop(index)