Question: I am having issues with this program.. I have gone through and changed things once and thought I had it but I just keep getting


I am having issues with this program..
I have gone through and changed things once and thought I had it but I just keep getting errors.
# ADD CODE FOR SHOWSTACK, MYEMPTY, MYPUSH, MYPOP, MYPEEK WITHOUT THE BUILT-IN FUNCT! #USE A FIXED SIZE ARRAY FILLED WITH 0 (USER SELECTS THE SIZE UPFRONT) . #YOU CAN USE THE BUILT-IN FUNCTIONS TO CHECK OUTCOMES class Stack: def init_(self): self.stack[] def showStack(self): #complete this function return # just a placeholder def isEmpty(self): return self.stack [] def myEmpty(self): #complete this function return # just a placeholder def push(self, data): self.stack.append (data) def myPush(self, data): #complete this function return # just a placeholder def pop (self): dataself.stack[-1 del self.stack[-1] return data def myPop(self): #complete this function return # just a placeholder def peek (self): return self.stack[-1] def myPeek(self): #complete this function return # just a placeholder def sizestack(self): return len(self.stack) stack Stack() stack.push(111) stack.push(222) stack.push(333) print(stack.sizeStack()) print(" Popped: ", stack.pop()) print(" Popped: ", stack.pop()) print(stack.sizeStack()) print("Peek:", stack.peek()) print(stack.sizeStack()) # ADD CODE FOR SHOWSTACK, MYEMPTY, MYPUSH, MYPOP, MYPEEK WITHOUT THE BUILT-IN FUNCT! #USE A FIXED SIZE ARRAY FILLED WITH 0 (USER SELECTS THE SIZE UPFRONT) . #YOU CAN USE THE BUILT-IN FUNCTIONS TO CHECK OUTCOMES class Stack: def init_(self): self.stack[] def showStack(self): #complete this function return # just a placeholder def isEmpty(self): return self.stack [] def myEmpty(self): #complete this function return # just a placeholder def push(self, data): self.stack.append (data) def myPush(self, data): #complete this function return # just a placeholder def pop (self): dataself.stack[-1 del self.stack[-1] return data def myPop(self): #complete this function return # just a placeholder def peek (self): return self.stack[-1] def myPeek(self): #complete this function return # just a placeholder def sizestack(self): return len(self.stack) stack Stack() stack.push(111) stack.push(222) stack.push(333) print(stack.sizeStack()) print(" Popped: ", stack.pop()) print(" Popped: ", stack.pop()) print(stack.sizeStack()) print("Peek:", stack.peek()) print(stack.sizeStack())
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
