IMPORTANT : In this exercise, implementations of boththe Stack and Queue ADTs are available to you. You can simply usethe functions Stack(), push(), pop(), is_empty() as well asenqueue() and dequeue() as necessary in your functiondefinition.
For this exercise, you must write a function calledreverse_queue() which is passed a Queue as aninput. Your function must modify the Queue, sothat the elements in the queue are rearranged intoreverse order.
You must make use of a Stack to help you reversethe elements in the queue.
For example:
TestResultq1 = Queue()q1.enqueue(1)q1.enqueue(2)q1.enqueue(3)reverse_queue(q1)while not q1.is_empty(): print(q1.dequeue())321q1 = Queue()q1.enqueue(1)reverse_queue(q1)while not q1.is_empty(): print(q1.dequeue())1
and
A palindrome is a
PayPal Gateway not configured
PayPal Gateway not configured