Question: In python please! Using: and with this format: 2. Define a function named stackToqueue. This function expects a stack as an argument. The function builds
In python please!

Using:

and with this format:

2. Define a function named stackToqueue. This function expects a stack as an argument. The function builds and returns an instance of LinkedQueue that contains the items in the stack. The function assumes that the stack has the interface described in Chapter 7, "Stacks." The function's postconditions are that the stack is left in the same state as it was before the function was called, and that the queue's front item is the one at the top of the stack. class Queve: (self): \# Constructor function self. items = [] def isEmpty(self): \# Returns True if the queue is empty or False otherwise return len(self.items) =0 def len(self): \# Returns the number of items in the queue return len(self.items) def peek(self): \# Returns the iten at the front of the queue if self. isEmpty(): return self. items[0] def add(self, item): \# Adds item to the rear of the queue self. items. append(item) pop (self): \# Removes and returns the iten at the front of the queue if self. isEmpty()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
