class arrayqueue """fifo queue implementation using python list as underlying storage ""moderate capacity for all new queues default capacity def init (self) """create an empty queue "" self data [nonearrayqueue default capacity self size self front def len (self) """return the number of elements in the queue "" return self size def is empty(self) """return true if the queue is empty "" return self size = def first(self) """return (but do not removethe element at the front of the queue raise empty exception if the queue is empty "" if self is empty) raise emptyqueue is empty return self data[self front def dequeue(self) """remove and return the first element of the queue ( fifo raise empty exception if the queue is empty "" if self is empty) raise emptyqueue is empty answer self data[self fronthelp garbage collection self data[self frontnone self front (self front len(self data self size - return answer code fragment array-based implementation of queue (continued in code fragment