the queue abstract data type formallythe queue abstract data type defines collection that keeps objects in sequencewhere element access and deletion are restricted to the first element in the queueand element insertion is restricted to the back of the sequence this restriction enforces the rule that items are inserted and deleted in queue according to the first-infirst-out (fifoprinciple the queue abstract data type (adtsupports the following two fundamental methods for queue qq enqueue( )add element to the back of queue dequeue)remove and return the first element from queue qan error occurs if the queue is empty the queue adt also includes the following supporting methods (with first being analogous to the stack' top method) first)return reference to the element at the front of queue qwithout removing itan error occurs if the queue is empty is empty)return true if queue does not contain any elements len( )return the number of elements in queue qin pythonwe implement this with the special method len by conventionwe assume that newly created queue is emptyand that there is no priori bound on the capacity of the queue elements added to the queue can have arbitrary type example the following table shows series of queue operations and their effects on an initially empty queue of integers operation enqueue( enqueue( len(qq dequeueq is emptyq dequeueq is emptyq dequeueq enqueue( enqueue( firstq enqueue( len(qq dequeuereturn value false true "error first last [ [ [ [ [ [[[[ [ [ [ [ [