Question: PART B B . 1 . [ 6 marks ] Consider the following python program. class Stack: d e f i nit ( self )

PART B
B.1.[6 marks]
Consider the following python program.
class Stack:
definit ( self):
self.items =
def Push(self, item):
self.items.append(item)
def Pop(self):
return self.items.pop 0
def isEmpty(self):
return self.items ==
def size(self):
return len(self.items)
return self.items.pop0
def isEmpty(self):myStack = Stack 0myStack.Push(1)myStack.Push(3)item = myStack.PopOprint(item)myStack.Push(5)myStack.Push(7)item = myStack.PopOprint(item)myStack.Push(9)myStack.Push(11)item = myStack.Pop(print(item)while not myStack.isEmpty):item = myStack.Pop()print(item)(a) What will be printed in the first three print(item) statements?rarr print: (1)(3)(1 stack.(b) What will be printed in the while loop?
 PART B B.1.[6 marks] Consider the following python program. class Stack:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!