Question: Use the attached stack.py file and add the following function that will use the stack data structure: A getStat function that gets a stack of
Use the attached stack.py file and add the following function that will use the stack data structure:
- A getStat function that gets a stack of integers as an input, and calculates the highest and lowest numbers in the stack, as well as the sum of all of the integers in the stack. You may manipulate the original stack any way but upon completion of the function, the original stack must be restored to its original configuration (The stack should have the same numbers before and after calling the function).
- A main function that tests the function you wrote in 1 above.
*Attached .py file contents:*

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
Get step-by-step solutions from verified subject matter experts
