Page 1 of 1

2) Given that the Stack and Queue classes have been implemented correctly, what is the output of the following? s = Stac

Posted: Mon May 09, 2022 5:53 am
by answerhappygod
2) Given that the Stack and Queue classes have been implemented
correctly, what is the output of the following?
s = Stack()
q = Queue()
s.push(3)
q.enqueue(4)
q.enqueue(6)
q.enqueue(s.pop()+2)
s.push(q.dequeue()+5)
q.enqueue(s.pop()-1)
print(q.dequeue(),q.dequeue(),q.dequeue())