I'm trying to implement a simple SSTF program and trying to iterate over the queue of processes that have come in and subsequently delete anything that I have taken into account but it says "Out of index error".
for i in xrange(0,len(queue)):
    for j in xrange(0,(len(queue))):
        a = abs(queue[j]-initial_position)
        if(min>a):
            min = a
            pos = j
initial_position=queue[pos]
final_queue.append(initial_position)
del(queue[pos])
The complete error message:
initial_position=queue[pos]
IndexError: list index out of range
I'm really confused.
 
     
    