Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want a layout on how I would do this I'm really just wondering on how it would do this based on the things I
I want a layout on how I would do this I'm really just wondering on how it would do this based on the things I needed to use. I really appreciate the help.
use this py file to help solve the problems
Evaluation A rubric will be used to evaluate your solution. Description Develop a Python solution to the following problems. 1. Motivating questions. a. Using the Stack class, what happens when you try to do a pop() operation on an empty Stack? b. Using the Stack class, what happens when you try to do a peek() operation on an empty Stack? 2. Create a new Stack class, called Stack2, and modify the following methods. a. pop() i. Return None when the stack is empty. b. peek() i. Return None when the stack is empty. C. In your stack2.py source code file, add test functions and test code to test the modifications you made to each method. 3. Create a new Stack class, called Stack3, and modify the following methods. a. popo i. Raise an Exception when the stack is empty. Include an appropriate message to be displayed when the Exception is printed. The statement will look something like: raise Exception (appropriate message") b. peek) i. Raise an Exception when the stack is empty. Include an appropriate message to be displayed when the Exception is printed. In your stack3.py source code file, add test functions and test code to test the modifications you made to each method. 4. What files should you submit? a. Submit two Python source code files - stack2.py and stack3.py - as described in steps 2 and 3. #stack.py class Stack: def __init_(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop (self): return self.items.pop() def peek(self): return self.items[len(self.items)-1] def size(self): return len(self.items)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started