Question: Assignment 02: Stack class Follow the directions below to complete this assignment. Evaluation A rubric will be used to evaluate your solution. Description Develop a

 Assignment 02: Stack class Follow the directions below to complete this

Assignment 02: Stack class Follow the directions below to complete this assignment. 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. 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. pop() 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. C. 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

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!